Lec6 Operating System
Lec6 Operating System
We
Parts
2-2
The
concept of process:
Most fundamental concept of modern operating systems is the distinction between a program and the activity of executing a program. Program: a static set of directions. Activity of executing a program: a dynamic activity whose properties change as time progresses.
2-3
The
activity of executing a program under the control of the operating system is know as a process. Associated with the process is the current status of the activity called the process state. This state includes
The current position in the program being executed( the value of program counter). As well as the value in the other CPU registers and the associated memory cells.
2-4
Roughly
speaking, the process state is a snapshot of the machine at a particular time. At different times during the execution of a program different snapshots will be observed. Time sharing/multi-tasking computers are running many processes, all competing for the computers resources.
2-5
It
2-6
The
tasks associated with coordinating the execution of processes are handled by the scheduler and the dispatcher within the operating systems kernal. The scheduler:
Maintains a record of the processes present in the computer system Introduces new processes to this pool. Removes complete processes from the pool
2-7
Thus
when a user requests the execution of an application, it is the scheduler that adds the execution of that application to the pool of current processes. To keep track of all the processes, the scheduler maintains a block of information in main memory called process table.
2-8
Each
The memory area assigned to the process The priority of the process Whether the process is ready or waiting.
process is ready if it is in a state in which its progress can continue. A process is waiting if its progress is currently delayed until some external event occurs.
2-9
The
dispatcher is the component of the kernel that overseas the execution of the scheduler processes. In a time-sharing/multitasking system this task is accomplished by multi-programming
That is, dividing time into short segment, each called a time slice. Then switching the CPUs attention among the processes as each is allowed to execute for one time slice. The procedure of changing from one process to another is called a process switch.
2-10
2-11
Each
time the dispatcher awards a time slice to a process, it initiates a timer circuit that will indicate the end of the slice by generating a signal called an interrupt.
The CPU reacts to this interrupt signal in much the same way that you react when interrupted from a task. Then take care of the interrupting entity.
2-12
completes its current machine cycle, Saves its position in the current process Begins executing a program called interrupt handler
It is stored at a predetermined location in main memory. It is a part of the dispatcher It describes how the dispatcher should respond to the interrupt signal.
2-13
Thus
the effect of the interrupt signal is to prevent the current process and transfer control back to the dispatcher. At this point, dispatcher:
Selects the process from the process table that has the highest priority among the ready processes, Restarts the timer circuit, Allows the selected process to begin its time slice
2-14
Paramount
CPUs
designed for multiprogramming systems incorporate the task of saving information of program counter, contents of registers and relevant memory cells as part of the CPUs reaction to the interrupt signal.
2-15
The
CPUs also tend to have machinelanguage instructions for reloading a previously saved state. Such features simplify the task of the dispatcher when preforming a process switch and illustrate how the design of modern CPUs is influenced by the needs of todays operating system.
2-16
Summarize
the difference between a program and a process. Summarize the steps performed by the CPU when an interrupt occurs. In a multiprogramming system, how can highpriority processes be allowed to run faster than others?
2-17
Program
is set of directions and process is the action of following those directions. CPU completes its machine cycle, saves the state of current process and sets its program counter to the predetermined value. Thus next instruction executed will be the first instruction within the interrupt handler. Given high priority so would be given preference by the dispatcher or give them longer time slices.
2-18