Figure monster _81f15acdf27c9e27dd3e2e54d3360863_79599

What is a process?

A process is an instance of an executing program. A process also contains the current values of program counters, registers, and variables. Conceptually, every

Each process has its own virtual CPU, but the reality is that the CPU switches back and forth between the processes.

Process model?

A process is an instance of an executing program. A process also contains the current values of program counters, registers, and variables. Conceptually, every

Each process has its own virtual CPU, but the reality is that the CPU switches back and forth between the processes.

For example,

The four programs are abstracted into four processes that have their own control flow (that is, each of their own program counters), and each program runs independently. when

However, there is really only one physical program counter, and when each program is run, its logical program counter is loaded into the physical program counter. When the program

When it finishes running, its physical program counter is the real program counter and is then put back into the process’s logical counter.

An overview of the

A process is the sum of a particular kind of activity, with programs, inputs, outputs, and states. A single processor can be shared by several processes using a

These scheduling algorithms decide when to stop working on one process and switch to serving another process

Process status

Each process is a separate entity with its own program counters and internal state, but there are relationships between processes

1. Running state, which refers to the process that actually occupies CPU time slices when it is running (obtaining CPU time slices)2. Ready, which is runnable but in a ready state (not yet given a CPU time slice) because another process is running. 3. Blocked, the process cannot run unless some external event occurs

Program scheduling refers to deciding which processes should be run first and for how long

At the bottom of the operating system is the scheduler, which has many processes on it. All about interrupt handling, startup

The details of the process and the stopping process are hidden in the scheduler. In fact, the scheduler is just a very

A small program

Process implementation

The operating system maintains a table, called the Process Table, to perform switching between processes. Each process occupies one

Schedule items. This entry contains important information about the state of the process, including program counters, stack Pointers, memory allocation, the status of open files,

Account and scheduling information, and other information that must be saved when a process transitions from running to ready or blocked

Information to ensure that the process can then be started again as if it had never been interrupted.

Why threads?

• Threads are lighter than processes, and because they are lighter, they are easier to create and destroy than processes. On many systems, creating a thread is 10-100 times faster than creating a process. • A third reason may be a performance argument, if multiple threads are CPU-intensive, there is no performance gain, but if there is a lot of computation and a lot of I/O processing, having multiple threads on top of each other in these activities can speed up application execution

Thread model?

A process has a thread of execution, often abbreviated as thread. The thread has a program counter that keeps track of which finger to execute next

Make; Threads also have registers that hold variables that the thread is currently using. Threads also have a stack, which keeps track of the program’s execution path. Though the line

Procedures must be executed in a process, but processes and threads are completely different concepts, and they can be handled separately. Processes are used to transfer resources

Threads are entities that are scheduled for execution on the CPU.

In multiple threads, each thread shares the same address space and other resources. In multiple processes, processes share physical memory, disks, printers, and more

Resources.

Thread state

Like processes, threads can be in one of the following states: running, blocked, ready, and terminated

Implementation of threads

• Implement threads in user space • Implement threads in kernel space • Mix implementation threads in user and kernel space

User-mode vs. kernel-mode threads

1. When a thread blocks, the kernel can choose between running another thread in the same process (if there are any ready threads) or running another thread in another process. But in a user implementation, the runtime system runs its own threads until the kernel deprives it of CPU time slices (or there are no runnable threads left). 3. The main difference between user-level threads and kernel-level threads is performance. While user-level thread switching requires a small number of machine instructions (think of thread switching in a Java program), kernel threads require a full context switch, modifying the memory image and invalidating the cache, resulting in orders of magnitude of delay. On the other hand, when using kernel-level threads, once the thread is blocked on I/O, there is no need to suspend the entire process as in user-level threads

Process of communication

• Race condition critical region busy and other mutex sleep and wake semaphore mutex message passing barrier to avoid locking

scheduling

If only one CPU is available, then you must choose which process/thread can run next. The operating system has something called a scheduler

A scheduler role exists that does just that, using an algorithm called the Scheduling algorithm.

• Scheduling in real-time systems: Real-time systems can be divided into two types: hard real time and soft real time systems. The former means that absolute deadlines must be met. The latter means you don’t want to miss deadlines occasionally, but you can tolerate them. • Scheduling in interactive systems: Round-robin Scheduling One of the oldest, simplest, fairest, and most widely used algorithms is the round-robin algorithm. Each process is assigned a period of time, called a quantum, within which processes are allowed to run priority scheduling. Polling scheduling assumes that all processes are equally important. But that may not be the case. For example, in a university hierarchy, first the dean, then the professors, secretaries, support staff, and finally the students. This consideration of external conditions enables priority scheduling.

An overview of figure

Article Reference:

Modern operating systems, fourth edition

Modern Operation System Fourth

Baike.baidu.com/item/SATA hard disk…

baike.baidu.com/item/ Virtual address /1…

www.cnblogs.com/cxuanBlog/p…