



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
These are the lecture Slides of Advanced Operating System which includes Virtual Memory Performance, Resident Set Management, Allocating Pages, Page Fault Frequency Algorithm, Working Set Strategy, Thrashing, Replacement Policy, Multiprogramming Level etc. Key important points are: Processes, Modes of Execution, Typical Functions, Memory Management, Support Functions, Remote Procedure Calls, File Sharing, Multiple Processes, Sharing System, Process Creation, Process Termination
Typology: Slides
1 / 7
This page cannot be seen from the preview
Don't miss anything!




11
22
An OS has many parts. An OS has many parts. The Kernel is the core of the OS. It The Kernel is the core of the OS. It controls the execution of the system.controls the execution of the system. Many OS features run outside of the Many OS features run outside of the kernel, such as the shell.kernel, such as the shell.
33
44
Kernel Mode
55
Process Management
Memory Management I/O Management
Support Functions
66
Shell ā Shellā user interface to the OS. Inuser interface to the OS. In Microsoft Windows, this is called theMicrosoft Windows, this is called the ExplorerExplorer (not the Internet Explorer)(not the Internet Explorer) .. File Sharing File Sharing Remote Procedure Calls Remote Procedure Calls
Utilities Utilities
77
The ProcessThe Process
Multiple ProcessesMultiple Processes
There are usually many processes existing There are usually many processes existing in the system.in the system. If there is only one CPU, then only one If there is only one CPU, then only one process can be running at any one time.process can be running at any one time. Other processes might be waiting to run. Other processes might be waiting to run. Some (most) processes will be blocked Some (most) processes will be blocked waiting for something to happen (i.e. I/O)waiting for something to happen (i.e. I/O)
99
Sharing the SystemSharing the System
Most programs perform a lot of I/O andMost programs perform a lot of I/O and therefore spend a lot of time waiting for I/Otherefore spend a lot of time waiting for I/O to complete.to complete. When a program is waiting for I/O, anotherWhen a program is waiting for I/O, another program can be running.program can be running. Some programs wait for a very long timeSome programs wait for a very long time for input (such as input from a keyboard,for input (such as input from a keyboard, mouse or network)mouse or network)
1010
āFrom a programmer's point of āFrom a programmer's point of view, the user is a peripheral thatview, the user is a peripheral that types when you issue a readtypes when you issue a read request.ārequest.ā
1111
Process CreationProcess Creation
Process TerminationProcess Termination
1919
Queuing ModelQueuing Model Multiple Blocked QueuesMultiple Blocked Queues
2020
DispatcherDispatcher
A part of the OS that gives the processor from one process to another Selects a process from the queue to execute after interrupt or process termination Prevents a single process from monopolizing the processor time
2121
Context SwitchContext Switch
When CPU switches to another process,When CPU switches to another process, the system must save the state of the oldthe system must save the state of the old process and load the saved state for theprocess and load the saved state for the new processnew process
ContextContext--switch time is overhead; theswitch time is overhead; the system does no useful work whilesystem does no useful work while switchingswitching
Time dependent on hardware supportTime dependent on hardware support
2222
Operating System Control StructuresOperating System Control Structures
2323
Process Control StructuresProcess Control Structures
2424
Process Control Block (PCB)Process Control Block (PCB)
2525
PCB ContentsPCB Contents
2626
PCB ContentsPCB Contents
2727
PCB ContentsPCB Contents
2828
Process CreationProcess Creation
Assign a unique Processor ID (PID). Assign a unique Processor ID (PID). Allocate RAM for the PCB Allocate RAM for the PCB Initialize the PCB Initialize the PCB Allocate RAM for the program (code, data, Allocate RAM for the program (code, data, stack and heap)stack and heap) Copy the program into the RAM Copy the program into the RAM Put the PCB on the list of PCBs Put the PCB on the list of PCBs
2929
Creating a new ProcessCreating a new Process
In C or C++, you can create a newIn C or C++, you can create a new process with the fork functionprocess with the fork function int fork();int fork(); When fork is called, the RAM of theWhen fork is called, the RAM of the program is copied to another location isprogram is copied to another location is RAM. A new process is created to run inRAM. A new process is created to run in the new program address space. The newthe new program address space. The new process is put on the ready list.process is put on the ready list.
3030
fork functionfork function
The return value of the fork function is: The return value of the fork function is: -1 = Error - 1 = Error 0 = This is the process that was just0 = This is the process that was just created.created. number = This process is the parent thatnumber = This process is the parent that just executed the fork function. Thejust executed the fork function. The number returned is the PID of the childnumber returned is the PID of the child process.process.
3737
shmctlshmctl
Shared memory control function can beShared memory control function can be used to delete a shared memory segment.used to delete a shared memory segment. shmctl(shared_id, IPC_RMID, NULL);
shared_idshared_id is the return value fromis the return value from shmgetshmget..
IPC_RMID is the function code to delete aIPC_RMID is the function code to delete a shared segment.shared segment.
3838
Programming NoteProgramming Note
Shared memory segments are permanent Shared memory segments are permanent data structures. They do NOT go awaydata structures. They do NOT go away when the program terminates.when the program terminates. Be sure to delete any and all shared Be sure to delete any and all shared memory segments you create.memory segments you create.
3939
Multiple Process ConflictsMultiple Process Conflicts
A process or thread can be halted at anyA process or thread can be halted at any time by the OS to run another process ortime by the OS to run another process or thread.thread.
4040
X++ in Machine LanguageX++ in Machine Language
LOADLOAD R1,XR1,X ADDADD R1,1R1, OS switches to another processOS switches to another process LOADLOAD R1,XR1,X ADDADD R1,1R1, STORE R1,XSTORE R1,X OS switches to another processOS switches to another process STORE R1,XSTORE R1,X