You are on page 1of 20

Operating system

Lecture 4
Agenda for Today

 VirtualMachine
 Operating system design and implementation
 Process concept
 Process scheduling concepts
 Process creation and termination
Virtual Machines
 CPU scheduling and virtual memory
techniques used to emulate hardware of
the underlying machine, on which user can
install an operating system that the virtual
machine supports
 On a time-sharing system with virtual
machine support, users may be working on
different operating systems
 Pioneered by IBM VM operating system
that ran CMS, a single-user interactive
operating system
Virtual Machines …
 Difficult to implement.
 System development done without
disrupting normal system operation.
Virtual Machines …

Without Virtual machine with Virtual Machine


VMWare on Windows
System Design and
Implementation
 Design Goals
 User: operating system should be
convenient to use, easy to learn, reliable,
safe, and fast.
 System designer and administrator:
operating system should be easy to
design, implement, and maintain, as well
as flexible, reliable, error-free, and
efficient.
System Design and
Implementation …
 Mechanism: determine how to do
something
 Policy: determine what will be done
 Separation of mechanism and policy is
important for flexibility.
System Design and
Implementation …
Implementation in:
 Assembly language
 Higher level languages:
 Easier to code
 Compact code
 Easier to port
What is a process?
 Process – a program in execution; process execution
must progress in sequential fashion.
 A process consists of:
 Code (text) section
 Data section
 Stack
 Heap
 Environment
 CPU state (program counter, etc.)
 Process control block (PCB)
CPU and I/O Bound Processes
Processes can be:
 I/O-bound process – spends more time doing I/O than
computations, many short CPU bursts.

I/O Burst CPU Burst I/O Burst CPU Burst

 CPU-bound process – spends more time doing


computations; few very long CPU bursts.

CPU Burst I/O CPU Burst I/O


Process States
As a process executes, it changes state
 new: The process is being created.
 ready: The process is waiting to be assigned to a
processor.
 running: Instructions are being executed.
 waiting: The process is waiting for some event to occur.
 terminated: The process has finished execution.
Process States
Process Control Block
(PCB)
Process information and attributes
 Process state
 Program counter
 CPU registers
 CPU scheduling information
 Memory-management information
 Accounting information
 I/O status information
 Per process file table
 Process ID (PID)
 Parent PID, etc.
Process Control Block
(PCB)
CPU Switch From Process to
Process
Process Scheduling
Queues
 Job queue – set of all processes in the system.
 Ready queue – set of all processes residing in main
memory, ready and waiting to execute.
 Device queues – set of processes waiting for I/O
devices.
 Process migration between the various queues.
Queues in the OS
Queues in a Computer
System
Schedulers
 Long term scheduler
 Short term scheduler
 Medium term scheduler

You might also like