当前位置:网站首页>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

边栏推荐
- QT qcombobox QSS style settings
- Hal library sets STM32 clock
- [csdn] C1 analyse des questions de formation Partie III Bar _ JS Foundation
- Convert IP address to int
- Leetcode daily question (1024. video sticking)
- Project cost management__ Topic of comprehensive calculation
- Project cost management__ Plan value_ Earned value_ Relationship among actual cost and Countermeasures
- How does the nr-prach receiver detect the relationship between prembleid and Ta
- STM32 serial communication principle
- Flink CDC practice (including practical steps and screenshots)
猜你喜欢

UCI and data multiplexing are transmitted on Pusch - Part I

Electronic product design

Quelle langue choisir pour programmer un micro - ordinateur à puce unique

UCI and data multiplexing are transmitted on Pusch (Part VI) -- LDPC coding

要选择那种语言为单片机编写程序呢

Difference of EOF

Electronic product design, MCU development, circuit cloning

Flink learning notes (XI) table API and SQL
![[CSDN]C1訓練題解析_第三部分_JS基礎](/img/b2/68d53ad09688f7fc922ac65e104f15.png)
[CSDN]C1訓練題解析_第三部分_JS基礎

Fundamentals of Electronic Technology (III)__ Logic gate symbols in Chapter 5
随机推荐
Directory and switching operation in file system
Nr--- Pusch I: sorting out the agreement process
IDEA远程断点调试jar包项目
[CSDN] C1 training problem analysis_ Part II_ Web Foundation
【顺利毕业】[1]-游览 [学生管理信息系统]
Intelligent home design and development
Leetcode daily question (2090. K radius subarray averages)
Vector processor 9_ Basic multilevel interconnection network
All processes of top ten management in project management
Starting from 0, use pnpm to build a demo managed by monorepo
Nodemcu-esp8266 development (vscode+platformio+arduino framework): Part 5 --blinker_ MIOT_ MULTI_ Outside (lighting technology app + Xiaoai classmate control socket multiple jacks)
Fundamentals of Electronic Technology (III)__ Chapter 6 combinational logic circuit
【順利畢業】[1]-遊覽 [學生管理信息系統]
Arduino handles JSON data, arduinojson assistant
MySQL data manipulation language DML common commands
Fundamentals of Electronic Technology (III)__ Logic gate symbols in Chapter 5
Nodemcu-esp8266 development (vscode+platformio+arduino framework): Part 3 --blinker_ MIOT_ Light (lighting technology app control + Xiaoai classmate control)
PIP references domestic sources
UCI and data multiplexing are transmitted on Pusch (Part VI) -- LDPC coding
GPIO port details, Hal library operation keys