Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize multitasking in linux

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail how to achieve multitasking in linux, the quality of the article content is high, so Xiaobian shares it for everyone to make a reference, I hope you have a certain understanding of relevant knowledge after reading this article.

1) Input device speed is slow and CPU execution time is fast. In this case, CPU will often be idle. Solution: CPU execution time is segmented, called time slice; memory is also segmented.

A. Principle:

A CPU can execute only one program at a time, and a memory segment can store only one executable program. CPU execution time is continuous, and memory access instructions are numbered

In descending order.

After CPU time and memory segmentation, each time slice executes an executable program, and multiple programs executed in parallel are divided into numbered memory segments, one for each CPU time slice. use it or lose

The program monitors the execution of the previous program. If the execution is not completed within the current time slice of the current CPU execution cycle, the data and state are retained, and the time slice coming in the current cycle is executed next.

The program responsible for management and execution will start executing a new cycle time after the end of this CPU time cycle, and the program that has not been executed will continue to run again at the position of the previous time slice.

under procedural orders.

The program that is running is a process, so there are multiple processes.

The operating system is responsible for allocating CPU time slices and memory segments, and ensuring that the programs (called processes) being executed in the time slices run and end within the specified time, retaining the state and execution results of the arithmetic units,

Monitoring, scheduling and management of tasks.

B. The operating system is a general purpose software. When installed on the host computer, the computing power provided by the hardware itself is simulated by using the software, so the user program is not directly operating the hardware.

Dealing with the interfaces provided by the operating system is indirect.

C. Operating systems are often very low-level in order to simplify interfaces. There is a kernel in the operating system, and the function of the kernel is system calls. Encapsulate the lowest-level interface functions into system calls, and these encapsulated

The lowest layer system call is called kernel, user program to access hardware, must go through the request kernel, by the kernel instead of user program access hardware

The hardware returns the result to the kernel, and the kernel returns the returned result to the user, so the user cannot directly touch the hardware. So the kernel acts as a go-between.

D. The lowest level of system calls are encapsulated twice, and one or more of their functions are encapsulated to make a higher-level interface. This interface is the library, the so-called API.

2) sell is a software that associates computer functions to an interface that humans can touch and operate, thus achieving human-computer interaction, that is, people can operate user programs, users

Programs interact directly or indirectly with libraries, operating systems, and hardware.

3) The bottom layer of different operating systems is written in assembly language, but the code written is different. The hardware interface of the host is fixed, so different operating systems can run on the host.

Do some processing, such as the lowest level of the operating system remains unchanged, but in the middle of different operating systems to extract an environment interface that both sides can adapt to, as long as this interface is provided, any

The host can adapt to different operating systems, and this environment interface is the API, the so-called library.

How to achieve multitasking in linux to share here, I hope the above content can be of some help to everyone, you can learn more knowledge. If you think the article is good, you can share it so that more people can see it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report