当前位置:网站首页>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
边栏推荐
- 【順利畢業】[1]-遊覽 [學生管理信息系統]
- 1300. sum of varied array closed to target
- Happy Dragon Boat Festival—— Zongzi written by canvas~~~~~
- Global KYC service provider advance AI in vivo detection products have passed ISO international safety certification, and the product capability has reached a new level
- Comment la base de données mémoire joue - t - elle l'avantage de la mémoire?
- Nodemcu-esp8266 development (vscode+platformio+arduino framework): Part 4 --blinker_ DHT_ WiFi (lighting technology app control + temperature and humidity data app display)
- [graduation successful] [1] - tour [Student Management Information System]
- Leetcode daily question (1024. video sticking)
- Implementing distributed lock with redis
- Schematic diagram and connection method of six pin self-locking switch
猜你喜欢
Nodemcu-esp8266 development (vscode+platformio+arduino framework): Part 4 --blinker_ DHT_ WiFi (lighting technology app control + temperature and humidity data app display)
How does the nr-prach receiver detect the relationship between prembleid and Ta
Successful graduation [2] - student health management system function development...
CEF download, compile project
Global KYC service provider advance AI in vivo detection products have passed ISO international safety certification, and the product capability has reached a new level
Uncle Wang's blog directory [constantly updating]
Shell logic case
当你需要使用STM32某些功能,而51实现不了时, 那32自然不需要学
C language enumeration type
Matlab reads hexadecimal numbers and converts them into signed short
随机推荐
Uncle Wang's blog directory [constantly updating]
Flink learning notes (IX) status programming
Leetcode daily question (2090. K radius subarray averages)
Matlab reads hexadecimal numbers and converts them into signed short
1300. sum of varied array closed to target
Nodemcu-esp8266 development (vscode+platformio+arduino framework): Part 1 -- establishment of engineering template -template
单片机职业发展:能做下去的都成牛人了,熬不动就辞职或者改行了
內存數據庫究竟是如何發揮內存優勢的?
PIP references domestic sources
Leetcode daily question (745. prefix and suffix search)
编程思想比任何都重要,不是比谁多会用几个函数而是比程序的理解
QT sub window is blocked, and the main window cannot be clicked after the sub window pops up
【順利畢業】[1]-遊覽 [學生管理信息系統]
STM32 external interrupt experiment
[combinatorics] Introduction to Combinatorics (context of combinatorics | skills of combinatorics | thought of combinatorics 1: one-to-one correspondence)
Project cost management__ Cost management technology__ Article 7 completion performance index (tcpi)
All processes of top ten management in project management
Flink CDC practice (including practical steps and screenshots)
Nr-prach:prach format and time-frequency domain
【力扣刷题笔记(二)】特别技巧,模块突破,45道经典题目分类总结,在不断巩固中精进