当前位置:网站首页>An executable binary file contains more than machine instructions
An executable binary file contains more than machine instructions
2022-07-03 09:50:00 【Brother gun plays embedded】
Why? Linux and Windows The executable of cannot be used universally ?
The main reasons are different formats and API Different , The former is more important .
An executable binary file contains more than machine instructions , It also includes various data 、 Program running resources , Machine instructions are only part of it .

One When an executable file is to be executed , The operating system needs to allocate resources , These resources include : Memory space ( Physical and virtual ), process 、 Thread resources and so on , The machine instructions of executable files are generally All in code snippets ( In assembly language, it is called text paragraph ), Other resources may be put into data segments and other segments .
there “ paragraph ”(segment) It can be roughly understood as a memory range . Operating system system (Windows/Linux) You need to know how much memory this executable needs , How many segments , Which memory addresses are loaded respectively . The executable needs to tell the operating system , Be enforceable Line file prepares what things it can run .
The article is relatively long , More words , You can first open the avatar and pay attention to me , Then take your time ,/// Insert a : At the beginning of this year, I recorded a set of systematic introductory single chip microcomputer tutorial , If you want, just ask me for it. It's free , I can send a private message ~ Click the black font in the lower left corner of my avatar and I can also get it . I've been relatively idle recently , Take me to finish the design , Take students to provincial or above competitions ///

Executable before execution , The operating system needs some preparation , Because of the different operating systems , Preparation is different , So the format of executable file is not exactly the same .Windows Most of the executable files on are PE Format ,Linux Most executable files in are ELF Format . Different formats lead to different executable files that cannot be used directly across platforms . This is one of the reasons .
Yes, of course , I've seen great gods on the Internet solve some problems with different formats , But cross platform operation still needs to solve another obstacle , It's the operating system API Different . Most operations performed by an executable ( such as : File operations 、 Input and output 、 Memory request release 、 Task scheduling and so on ) Need to interact with the operating system to complete , Different operating systems use these operations in completely different ways , So this obstacle is more difficult to overcome . This is the second reason .
Such as If we can solve the above two reasons , In theory, some executable files can span Windows and Linux stay x86 Running on the platform , because Intel and AMD Of CPU in , The main hard Piece instructions ( Machine instructions ) It's the same , in other words 0101 This binary number , It's the same . But if you switch to ARM platform , The bigger problem is that the hardware instructions are different , Then there is no way 了 .

Friends interested in MCU can come to me , I recorded some introductory tutorials about MCU , If you need children's shoes, just ask me for them , Free of charge , Private confidence in me “ Miss Lin ” You can take ~ Click to open my avatar to receive
Is it possible to have executable files running across platforms , Theoretically, it exists , In the past, there were also some ways , But there are many restrictions , such as Windows too Go for support COM Format of the file , This file has no header , The size cannot exceed 64K, Only in one 16 In an environment ( Real or virtual ) function , Is a real bare binary . Linux In some BIN The file happens to be a raw binary ( There are some BIN No document ELF head , But not all BIN It's all like this ).
After some configuration BIN Documents can also be found in Linux Running on . So some exquisitely designed COM/BIN Files can run across platforms under extremely restrictive circumstances , But maybe it can only be calculated , Unable to output , The size is only 64K Big , also If you want to do something a little more complicated , You need two sets of machine code to realize . in addition , unfortunately 64 In an environment COM Files are no longer supported .
Okay , That's all for this issue , If you think it's helpful to you in front of the screen, please press one button three times

边栏推荐
- Vscode Arduino installation Library
- Oracle数据库 SQL语句执行计划、语句跟踪与优化实例
- Design and development of biological instruments
- IDEA远程断点调试jar包项目
- The third paper of information system project manager in soft examination
- Leetcode daily question (931. minimum falling path sum)
- Fundamentals of Electronic Technology (III)_ Chapter 2 principle of amplification circuit__ Crystal triode and field effect triode
- 嵌入式本来就很坑,相对于互联网来说那个坑多得简直是难走
- 【力扣刷题笔记(二)】特别技巧,模块突破,45道经典题目分类总结,在不断巩固中精进
- 单片机学到什么程度能找到工作,这个标准不好量化
猜你喜欢

Oracle数据库 SQL语句执行计划、语句跟踪与优化实例

在三线城市、在县城,很难毕业就拿到10K

Development of fire power monitoring system

IDEA远程断点调试jar包项目

Fundamentals of Electronic Technology (III)_ Chapter 2 principle of amplification circuit__ Crystal triode and field effect triode

Matlab reads hexadecimal numbers and converts them into signed short

Happy Dragon Boat Festival—— Zongzi written by canvas~~~~~

numpy. Reshape() and resize() functions

【男保姆式】教你打开第一个微信小程序
![Successful graduation [2] - student health management system function development...](/img/91/72cdea3eb3f61315595330d2c9016d.png)
Successful graduation [2] - student health management system function development...
随机推荐
【22毕业季】我是毕业生yo~
学历是一张通行证,门票,你有了它,可以踏入更高层次的环境里
Epoll read / write mode in LT and et modes
我想各位朋友都应该知道学习的基本规律就是:从易到难
Runtime. getRuntime(). GC () and runtime getRuntime(). The difference between runfinalization()
How does the nr-prach receiver detect the relationship between prembleid and Ta
307. Range Sum Query - Mutable
MySQL的简单使用(增删改查)
[22 graduation season] I'm a graduate yo~
Fundamentals of Electronic Technology (III)_ Integrated operational amplifier and its application__ Basic arithmetic circuit
Development of fire power monitoring system
Vscode Arduino installation Library
UCI and data multiplexing are transmitted on Pusch - determine the bit number of harqack, csi1 and csi2 (Part II)
Nr-prach: access scenario and access process
CEF download, compile project
[CSDN]C1训练题解析_第四部分_Web进阶
Leetcode daily question (1162. as far from land as possible)
万字手撕七大排序(代码+动图演示)
Learn the contents of 5g toolbox supporting NR through the NR resources provided by MATLAB
内存数据库究竟是如何发挥内存优势的?