SlideShare a Scribd company logo
1 of 35
Er. Nawaraj Bhandari
Topic 5
Operating System Support
Computer
Architecture
Operating System
 The OS is a program that manages the computer’s resources, provides
services for programmers, and schedules the execution of other programs
 An OS is a program that controls the execution of application programs and
acts as an interface between applications and the computer hardware. It can
be thought of as having two objectives:
 Convenience: An OS makes a computer more convenient to use.
 Efficiency: An OS allows the computer system resources to be used in an
efficient manner.
Layers and Views of a Computer System
Operating System Services
 Program creation
 Program execution
 Access to I/O devices
 Controlled access to files
 System access
 Error detection and response
 Accounting
Operating System Services
 Program creation: The OS provides a variety of facilities and services,
such as editors and debuggers, to assist the programmer in creating
programs. Typically, these services are in the form of utility programs
that are not actually part of the OS but are accessible through the
OS.
 Program execution: A number of steps need to be performed to
execute a program. Instructions and data must be loaded into main
memory, I/O devices and files must be initialized, and other resources
must be prepared. The OS handles all of this for the user
Operating System Services
 Access to I/O devices: Each I/O device requires its own specific set of
instructions or control signals for operation. The OS takes care of the
details so that the programmer can think in terms of simple reads and
writes.
 Controlled access to files: In the case of files, control must include an
understanding of not only the nature of the I/O device (disk drive,
tape drive) but also the file format on the storage medium. Again, the
OS worries about the details.
 Further, in the case of a system with multiple simultaneous users, the
OS can provide protection mechanisms to control access to the files.
Operating System Services
System access: In the case of a shared or public system, the OS
controls access to the system as a whole and to specific system
resources.
The access function must provide protection of resources and data
from unauthorized users and must resolve conflicts for resource
contention.
Operating System Services
Error detection and response: A variety of errors can occur while a
computer system is running. These include internal and external
hardware errors, such as a memory error, or a device failure or
malfunction; and various software errors, such as arithmetic overflow,
attempt to access forbidden memory location, and inability of the OS to
grant the request of an application.
 In each case, the OS must make the response that clears the error
condition with the least impact on running applications. The response
may range from ending the program that caused the error, to retrying
the operation, to simply reporting the error to the application.
Operating System Services
Accounting: A good OS collects usage statistics for various resources
and monitor performance parameters such as response time.
 On any system, this information is useful in anticipating the need for
future enhancements and in tuning the system to improve
performance.
 On a multiuser system, the information can be used for billing
purposes
O/S as a Resource Manager
A computer is a set of resources for the movement, storage, and
processing of data and for the control of
these functions.
The OS is responsible for managing these resources
O/S as a Resource Manager
Types of Operating System
 Interactive: In an interactive system, the user/programmer interacts directly with
the computer, usually through a keyboard/ display terminal, to request the
execution of a job or to perform a transaction. Furthermore, the user may,
depending on the nature of the application, communicate with the computer
during the execution of the job.
 Batch : A batch system is the opposite of interactive. The user’s program is
batched together with programs from other users and submitted by a computer
operator. After the program is completed, results are printed out for the user.
Pure batch systems are rare today. However, it will be useful to the description of
contemporary operating systems to examine batch systems briefly
 Single program (Uni-programming): Works only one program at a time
 Multi-programming (Multi-tasking): It work on more than one program at a time
Early Systems
 Late 1940s to mid 1950s
 No Operating System
 Programs interact directly with hardware
 Two main problems:
 Scheduling
 Setup time
Simple Batch Systems
 Resident Monitor program
 Users submit jobs to operator
 Operator batches jobs
 Monitor controls sequence of events to process batch
 When one job is finished, control returns to Monitor which reads next
job
 Monitor handles scheduling
Scheduling
Process:
 A program in execution
 The “animated spirit” of a program
 That entity to which a processor is assigned
Scheduling
 Key to multi-programming
 Long term
 Medium term
 Short term
 I/O
Long Term Scheduling
 Determines which programs are submitted for processing
 i.e. controls the degree of multi-programming
 Once submitted, a job becomes a process for the short term
scheduler
 (or it becomes a swapped out job for the medium term scheduler)
Long Term Scheduling
 In a batch system, or for the batch portion of a general-purpose OS,
newly submitted jobs are routed to disk and held in a batch queue.
The long-term scheduler creates processes from the queue when it
can. There are two decisions involved
 First, the scheduler must decide that the OS can take on one or more
additional processes.
 Second, the scheduler must decide which job or jobs to accept and
turn into processes. The criteria used may include priority, expected
execution time, and I/O requirements.
Medium Term Scheduling
 Part of the swapping function (more later…)
 Usually based on the need to manage multi-programming
 If no virtual memory, memory management is also an issue
 Thus, the swapping-in decision will consider the memory requirements
of the swapped-out processes.
Short Term Scheduler
 Dispatcher
 The short-term scheduler, also known as the dispatcher, executes
frequently and makes the fine-grained decision of which job to
execute next
 i.e. which job actually gets to use the processor in the next time slot
Five-State Process Model
Waiting
Halted
Five-State Process Model
New: A program is admitted by the high-level scheduler but is not yet ready
to execute. The OS will initialize the process, moving it to the ready state.
Ready: The process is ready to execute and is awaiting access to the processor.
Running: The process is being executed by the processor.
Waiting: The process is suspended from execution waiting for some system
resource, such as I/O.
Halted: The process has terminated and will be destroyed by the OS.
Memory Management
 Uni-program
 Memory split into two
 One for Operating System (monitor)
 One for currently executing program
 Multi-program
 “User” part is sub-divided and shared among active processes
 The task of subdivision is carried out dynamically by the OS and is
known as memory management
Memory Management
 Effective memory management is vital in a multiprogramming system.
 If only a few processes are in memory, then for much of the time all
of the processes will be waiting for I/O and the processor will be idle.
 Thus, memory needs to be allocated efficiently to pack as many
processes into memory as possible
Swapping
 Problem: I/O is so slow compared with CPU that even in multi-
programming system, CPU can be idle most of the time
 Solutions:
 Increase main memory
 Expensive
 Leads to larger programs
 Swapping
What is Swapping?
 Long term queue of processes stored on disk
 Processes “swapped” in as space becomes available
 As a process completes it is moved out of main memory
 If none of the processes in memory are ready (i.e. all I/O blocked)
 Swap out a blocked process to intermediate queue
 Swap in a ready process or a new process
 But swapping is an I/O process...
Partitioning
 Splitting memory into sections to allocate to processes (including
Operating System)
 Fixed-sized partitions
 May not be equal size
 Process is fitted into smallest hole that will take it (best fit)
 Some wasted memory
 Leads to variable sized partitions
Fixed
Partitioning
Variable Sized Partitions (1)
 Allocate exactly the required memory to a process
 This leads to a hole at the end of memory, too small to use
 Only one small hole - less waste
 When all processes are blocked, swap out a process and bring in
another
 New process may be smaller than swapped out process
 Another hole
Variable Sized Partitions (2)
 Eventually have lots of holes (fragmentation)
 Solutions:
 Coalesce - Join adjacent holes into one large hole
 Compaction - From time to time go through memory and move all hole into one
free block (c.f. disk de-fragmentation)
Effect of Dynamic Partitioning
Relocation
 No guarantee that process will load into the same place in memory
 Instructions contain addresses
 Locations of data
 Addresses for instructions (branching)
 Logical address - relative to beginning of program
 Physical address - actual location in memory (this time)
 Automatic conversion using base address
Paging
 Split memory into equal sized, small chunks -page frames
 Split programs (processes) into equal sized small chunks - pages
 Allocate the required number page frames to a process
 Operating System maintains list of free frames
 A process does not require contiguous page frames
 Use page table to keep track
Logical and Physical Addresses - Paging
ANY QUESTIONS?

More Related Content

What's hot

Multiprogramming&timesharing
Multiprogramming&timesharingMultiprogramming&timesharing
Multiprogramming&timesharing
Tanuj Tyagi
 

What's hot (20)

Kernel. Operating System
Kernel. Operating SystemKernel. Operating System
Kernel. Operating System
 
Multiprogramming&timesharing
Multiprogramming&timesharingMultiprogramming&timesharing
Multiprogramming&timesharing
 
Contoh soal indentasi
Contoh soal indentasiContoh soal indentasi
Contoh soal indentasi
 
Elemen dasar sistem komputer
Elemen dasar sistem komputerElemen dasar sistem komputer
Elemen dasar sistem komputer
 
File management
File managementFile management
File management
 
Assembly Language
Assembly LanguageAssembly Language
Assembly Language
 
Computer Architecture
Computer ArchitectureComputer Architecture
Computer Architecture
 
SUMBER DAYA KOMPUTASI DAN KOMUNIKASI
SUMBER DAYA KOMPUTASI DAN KOMUNIKASISUMBER DAYA KOMPUTASI DAN KOMUNIKASI
SUMBER DAYA KOMPUTASI DAN KOMUNIKASI
 
Chapter 3 - Processes
Chapter 3 - ProcessesChapter 3 - Processes
Chapter 3 - Processes
 
(P 2) imk2 faktor-manusia
(P 2) imk2 faktor-manusia(P 2) imk2 faktor-manusia
(P 2) imk2 faktor-manusia
 
Operating System PPT
Operating System PPTOperating System PPT
Operating System PPT
 
15 maintaining & troubleshooting windows
15 maintaining & troubleshooting windows15 maintaining & troubleshooting windows
15 maintaining & troubleshooting windows
 
Relevance of choice of system in mis
Relevance of choice of system in misRelevance of choice of system in mis
Relevance of choice of system in mis
 
POWER POINT SISTEM INFORMASI MANAJEMEN BSI SEMESTER 3
POWER POINT SISTEM INFORMASI MANAJEMEN BSI SEMESTER 3POWER POINT SISTEM INFORMASI MANAJEMEN BSI SEMESTER 3
POWER POINT SISTEM INFORMASI MANAJEMEN BSI SEMESTER 3
 
Analisis sistem informasi pemesanan tiket berbasis web
Analisis sistem informasi pemesanan tiket berbasis webAnalisis sistem informasi pemesanan tiket berbasis web
Analisis sistem informasi pemesanan tiket berbasis web
 
Fundamentals of Programming Chapter 2
Fundamentals of Programming Chapter 2Fundamentals of Programming Chapter 2
Fundamentals of Programming Chapter 2
 
Computer System Basics
Computer System BasicsComputer System Basics
Computer System Basics
 
Interprocess communication (IPC) IN O.S
Interprocess communication (IPC) IN O.SInterprocess communication (IPC) IN O.S
Interprocess communication (IPC) IN O.S
 
Testing&implementasi 4 5
Testing&implementasi 4 5Testing&implementasi 4 5
Testing&implementasi 4 5
 
Bab I Data Flow Diagram
Bab I Data Flow DiagramBab I Data Flow Diagram
Bab I Data Flow Diagram
 

Similar to Chapter 5

Operating system 2
Operating system 2Operating system 2
Operating system 2
matsapit
 
introduction To Operating System
introduction To Operating Systemintroduction To Operating System
introduction To Operating System
Luka M G
 
operating system over view.ppt operating sysyems
operating system over view.ppt operating sysyemsoperating system over view.ppt operating sysyems
operating system over view.ppt operating sysyems
JyoReddy9
 
Operating systems
Operating systemsOperating systems
Operating systems
oswaldm80
 
operatinndnd jdj jjrg-system-1(1) (1).pptx
operatinndnd jdj jjrg-system-1(1) (1).pptxoperatinndnd jdj jjrg-system-1(1) (1).pptx
operatinndnd jdj jjrg-system-1(1) (1).pptx
krishnajoshi70
 

Similar to Chapter 5 (20)

Advanced computer architecture lesson 1 and 2
Advanced computer architecture lesson 1 and 2Advanced computer architecture lesson 1 and 2
Advanced computer architecture lesson 1 and 2
 
Fundamental Operating System Concepts.pptx
Fundamental Operating System Concepts.pptxFundamental Operating System Concepts.pptx
Fundamental Operating System Concepts.pptx
 
Ch1
Ch1Ch1
Ch1
 
Introduction of operating system
Introduction of operating systemIntroduction of operating system
Introduction of operating system
 
Basics of Operating System
Basics of Operating SystemBasics of Operating System
Basics of Operating System
 
Chapter 2 operating systems
Chapter 2 operating systemsChapter 2 operating systems
Chapter 2 operating systems
 
Software concepts
Software concepts Software concepts
Software concepts
 
R20CSE2202-OPERATING-SYSTEMS .pdf
R20CSE2202-OPERATING-SYSTEMS        .pdfR20CSE2202-OPERATING-SYSTEMS        .pdf
R20CSE2202-OPERATING-SYSTEMS .pdf
 
Operating system 2
Operating system 2Operating system 2
Operating system 2
 
ch1.ppt
ch1.pptch1.ppt
ch1.ppt
 
introduction To Operating System
introduction To Operating Systemintroduction To Operating System
introduction To Operating System
 
operating system over view.ppt operating sysyems
operating system over view.ppt operating sysyemsoperating system over view.ppt operating sysyems
operating system over view.ppt operating sysyems
 
Fundamental concepts and_principles_of_operating_systems (2)
Fundamental concepts and_principles_of_operating_systems (2)Fundamental concepts and_principles_of_operating_systems (2)
Fundamental concepts and_principles_of_operating_systems (2)
 
Operating systems
Operating systemsOperating systems
Operating systems
 
Ch1
Ch1Ch1
Ch1
 
operatinndnd jdj jjrg-system-1(1) (1).pptx
operatinndnd jdj jjrg-system-1(1) (1).pptxoperatinndnd jdj jjrg-system-1(1) (1).pptx
operatinndnd jdj jjrg-system-1(1) (1).pptx
 
Operating System
Operating SystemOperating System
Operating System
 
Os
OsOs
Os
 
Os
OsOs
Os
 
Operating system Concepts
Operating system Concepts Operating system Concepts
Operating system Concepts
 

More from Er. Nawaraj Bhandari

More from Er. Nawaraj Bhandari (20)

Data mining approaches and methods
Data mining approaches and methodsData mining approaches and methods
Data mining approaches and methods
 
Research trends in data warehousing and data mining
Research trends in data warehousing and data miningResearch trends in data warehousing and data mining
Research trends in data warehousing and data mining
 
Mining Association Rules in Large Database
Mining Association Rules in Large DatabaseMining Association Rules in Large Database
Mining Association Rules in Large Database
 
Introduction to data mining and data warehousing
Introduction to data mining and data warehousingIntroduction to data mining and data warehousing
Introduction to data mining and data warehousing
 
Data warehouse testing
Data warehouse testingData warehouse testing
Data warehouse testing
 
Data warehouse physical design
Data warehouse physical designData warehouse physical design
Data warehouse physical design
 
Data warehouse logical design
Data warehouse logical designData warehouse logical design
Data warehouse logical design
 
Classification and prediction in data mining
Classification and prediction in data miningClassification and prediction in data mining
Classification and prediction in data mining
 
Chapter 3: Simplification of Boolean Function
Chapter 3: Simplification of Boolean FunctionChapter 3: Simplification of Boolean Function
Chapter 3: Simplification of Boolean Function
 
Chapter 6: Sequential Logic
Chapter 6: Sequential LogicChapter 6: Sequential Logic
Chapter 6: Sequential Logic
 
Chapter 5: Cominational Logic with MSI and LSI
Chapter 5: Cominational Logic with MSI and LSIChapter 5: Cominational Logic with MSI and LSI
Chapter 5: Cominational Logic with MSI and LSI
 
Chapter 4: Combinational Logic
Chapter 4: Combinational LogicChapter 4: Combinational Logic
Chapter 4: Combinational Logic
 
Chapter 2: Boolean Algebra and Logic Gates
Chapter 2: Boolean Algebra and Logic GatesChapter 2: Boolean Algebra and Logic Gates
Chapter 2: Boolean Algebra and Logic Gates
 
Chapter 1: Binary System
 Chapter 1: Binary System Chapter 1: Binary System
Chapter 1: Binary System
 
Introduction to Electronic Commerce
Introduction to Electronic CommerceIntroduction to Electronic Commerce
Introduction to Electronic Commerce
 
Evaluating software development
Evaluating software developmentEvaluating software development
Evaluating software development
 
Using macros in microsoft excel part 2
Using macros in microsoft excel   part 2Using macros in microsoft excel   part 2
Using macros in microsoft excel part 2
 
Using macros in microsoft excel part 1
Using macros in microsoft excel   part 1Using macros in microsoft excel   part 1
Using macros in microsoft excel part 1
 
Using macros in microsoft access
Using macros in microsoft accessUsing macros in microsoft access
Using macros in microsoft access
 
Testing software development
Testing software developmentTesting software development
Testing software development
 

Recently uploaded

Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
Kamal Acharya
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
MayuraD1
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
mphochane1998
 

Recently uploaded (20)

Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...
Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...
Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 

Chapter 5

  • 1. Er. Nawaraj Bhandari Topic 5 Operating System Support Computer Architecture
  • 2. Operating System  The OS is a program that manages the computer’s resources, provides services for programmers, and schedules the execution of other programs  An OS is a program that controls the execution of application programs and acts as an interface between applications and the computer hardware. It can be thought of as having two objectives:  Convenience: An OS makes a computer more convenient to use.  Efficiency: An OS allows the computer system resources to be used in an efficient manner.
  • 3. Layers and Views of a Computer System
  • 4. Operating System Services  Program creation  Program execution  Access to I/O devices  Controlled access to files  System access  Error detection and response  Accounting
  • 5. Operating System Services  Program creation: The OS provides a variety of facilities and services, such as editors and debuggers, to assist the programmer in creating programs. Typically, these services are in the form of utility programs that are not actually part of the OS but are accessible through the OS.  Program execution: A number of steps need to be performed to execute a program. Instructions and data must be loaded into main memory, I/O devices and files must be initialized, and other resources must be prepared. The OS handles all of this for the user
  • 6. Operating System Services  Access to I/O devices: Each I/O device requires its own specific set of instructions or control signals for operation. The OS takes care of the details so that the programmer can think in terms of simple reads and writes.  Controlled access to files: In the case of files, control must include an understanding of not only the nature of the I/O device (disk drive, tape drive) but also the file format on the storage medium. Again, the OS worries about the details.  Further, in the case of a system with multiple simultaneous users, the OS can provide protection mechanisms to control access to the files.
  • 7. Operating System Services System access: In the case of a shared or public system, the OS controls access to the system as a whole and to specific system resources. The access function must provide protection of resources and data from unauthorized users and must resolve conflicts for resource contention.
  • 8. Operating System Services Error detection and response: A variety of errors can occur while a computer system is running. These include internal and external hardware errors, such as a memory error, or a device failure or malfunction; and various software errors, such as arithmetic overflow, attempt to access forbidden memory location, and inability of the OS to grant the request of an application.  In each case, the OS must make the response that clears the error condition with the least impact on running applications. The response may range from ending the program that caused the error, to retrying the operation, to simply reporting the error to the application.
  • 9. Operating System Services Accounting: A good OS collects usage statistics for various resources and monitor performance parameters such as response time.  On any system, this information is useful in anticipating the need for future enhancements and in tuning the system to improve performance.  On a multiuser system, the information can be used for billing purposes
  • 10. O/S as a Resource Manager A computer is a set of resources for the movement, storage, and processing of data and for the control of these functions. The OS is responsible for managing these resources
  • 11. O/S as a Resource Manager
  • 12. Types of Operating System  Interactive: In an interactive system, the user/programmer interacts directly with the computer, usually through a keyboard/ display terminal, to request the execution of a job or to perform a transaction. Furthermore, the user may, depending on the nature of the application, communicate with the computer during the execution of the job.  Batch : A batch system is the opposite of interactive. The user’s program is batched together with programs from other users and submitted by a computer operator. After the program is completed, results are printed out for the user. Pure batch systems are rare today. However, it will be useful to the description of contemporary operating systems to examine batch systems briefly  Single program (Uni-programming): Works only one program at a time  Multi-programming (Multi-tasking): It work on more than one program at a time
  • 13. Early Systems  Late 1940s to mid 1950s  No Operating System  Programs interact directly with hardware  Two main problems:  Scheduling  Setup time
  • 14. Simple Batch Systems  Resident Monitor program  Users submit jobs to operator  Operator batches jobs  Monitor controls sequence of events to process batch  When one job is finished, control returns to Monitor which reads next job  Monitor handles scheduling
  • 15. Scheduling Process:  A program in execution  The “animated spirit” of a program  That entity to which a processor is assigned
  • 16. Scheduling  Key to multi-programming  Long term  Medium term  Short term  I/O
  • 17. Long Term Scheduling  Determines which programs are submitted for processing  i.e. controls the degree of multi-programming  Once submitted, a job becomes a process for the short term scheduler  (or it becomes a swapped out job for the medium term scheduler)
  • 18. Long Term Scheduling  In a batch system, or for the batch portion of a general-purpose OS, newly submitted jobs are routed to disk and held in a batch queue. The long-term scheduler creates processes from the queue when it can. There are two decisions involved  First, the scheduler must decide that the OS can take on one or more additional processes.  Second, the scheduler must decide which job or jobs to accept and turn into processes. The criteria used may include priority, expected execution time, and I/O requirements.
  • 19. Medium Term Scheduling  Part of the swapping function (more later…)  Usually based on the need to manage multi-programming  If no virtual memory, memory management is also an issue  Thus, the swapping-in decision will consider the memory requirements of the swapped-out processes.
  • 20. Short Term Scheduler  Dispatcher  The short-term scheduler, also known as the dispatcher, executes frequently and makes the fine-grained decision of which job to execute next  i.e. which job actually gets to use the processor in the next time slot
  • 22. Five-State Process Model New: A program is admitted by the high-level scheduler but is not yet ready to execute. The OS will initialize the process, moving it to the ready state. Ready: The process is ready to execute and is awaiting access to the processor. Running: The process is being executed by the processor. Waiting: The process is suspended from execution waiting for some system resource, such as I/O. Halted: The process has terminated and will be destroyed by the OS.
  • 23. Memory Management  Uni-program  Memory split into two  One for Operating System (monitor)  One for currently executing program  Multi-program  “User” part is sub-divided and shared among active processes  The task of subdivision is carried out dynamically by the OS and is known as memory management
  • 24. Memory Management  Effective memory management is vital in a multiprogramming system.  If only a few processes are in memory, then for much of the time all of the processes will be waiting for I/O and the processor will be idle.  Thus, memory needs to be allocated efficiently to pack as many processes into memory as possible
  • 25. Swapping  Problem: I/O is so slow compared with CPU that even in multi- programming system, CPU can be idle most of the time  Solutions:  Increase main memory  Expensive  Leads to larger programs  Swapping
  • 26. What is Swapping?  Long term queue of processes stored on disk  Processes “swapped” in as space becomes available  As a process completes it is moved out of main memory  If none of the processes in memory are ready (i.e. all I/O blocked)  Swap out a blocked process to intermediate queue  Swap in a ready process or a new process  But swapping is an I/O process...
  • 27. Partitioning  Splitting memory into sections to allocate to processes (including Operating System)  Fixed-sized partitions  May not be equal size  Process is fitted into smallest hole that will take it (best fit)  Some wasted memory  Leads to variable sized partitions
  • 29. Variable Sized Partitions (1)  Allocate exactly the required memory to a process  This leads to a hole at the end of memory, too small to use  Only one small hole - less waste  When all processes are blocked, swap out a process and bring in another  New process may be smaller than swapped out process  Another hole
  • 30. Variable Sized Partitions (2)  Eventually have lots of holes (fragmentation)  Solutions:  Coalesce - Join adjacent holes into one large hole  Compaction - From time to time go through memory and move all hole into one free block (c.f. disk de-fragmentation)
  • 31. Effect of Dynamic Partitioning
  • 32. Relocation  No guarantee that process will load into the same place in memory  Instructions contain addresses  Locations of data  Addresses for instructions (branching)  Logical address - relative to beginning of program  Physical address - actual location in memory (this time)  Automatic conversion using base address
  • 33. Paging  Split memory into equal sized, small chunks -page frames  Split programs (processes) into equal sized small chunks - pages  Allocate the required number page frames to a process  Operating System maintains list of free frames  A process does not require contiguous page frames  Use page table to keep track
  • 34. Logical and Physical Addresses - Paging