1
Lahore Garrison University
CSC523-Operating System
Week-1 Lecture-2
MCS Semester 2 Spring 2019
2
Instructor Contact Details
Name: Sabreena Nawaz
Course Instructor: CSC351- Operating System
Credit Hours: 5
Office Location: CS-Female Staff Room
Email:
[email protected] Visiting Hours: Wednesday (9-11 am)
Lab Work: Video Tutorials & Supervision by Instructor
Lahore Garrison University
3
Course Objectives
To learn the fundamentals of Operating Systems.
To learn the mechanisms of OS to handle processes and
threads and their communication
To learn the mechanisms involved in memory
management in contemporary OS.
To gain knowledge on distributed operating
system concepts that includes architecture,
Mutual exclusion algorithms, deadlock detection
algorithms and agreement protocolsUnderstand
how to read C++ doc library documentation and
reuse library code.
To learn programmatically to implement simple
OS mechanisms.
Lahore Garrison University
4
Course Contents
Following contents will be covered throughout the
semester in week wise lectures:
OS basics, OS types, system calls, process management,
inter process communication, communication in client
server systems, Thread concepts, thread types, thread
control block, thread designs, CPU scheduling, process
synchronization, bakery algorithm, hardware solutions to
synchronization, Problems of synchronization, deadlock
occurrence, prevention, avoidance recovery, Memory
management, virtual memory, page faults, replacement
algorithms, operating system security.
Lahore Garrison University
Text Book
Operating system concepts by
Abraham Silberschatz, Galvin,
Gagne, 9th edition
6
► Operating system
► Hardware and User
Preamble ► Computer system
(Past lesson layout
brief)
Lahore Garrison University
7
Chapter 1:
Introduction
Lahore Garrison University
8
Learning Outcomes
Single-user systems
Batch systems
Multiprogrammed systems
Time-sharing systems
Real-time systems
Interrupts, traps, and signals
CPU, I/O, and memory protection
Lahore Garrison University
9
Single user systems
► Personal computers – computer system dedicated to a single
user.(many but 1 at a time)
► Interactive(Accepting input from a human. Interactive
computer systems are programs that allow users to enter data
or commands. Most popular programs, such as word processors
and spreadsheet applications, are interactive.
► A non interactive program is one that, when started, continues
without requiring human contact. A compiler is a non
interactive program)
► User convenience and responsiveness.
Lahore Garrison University
1
0
Batch systems
► First Fundamental system.
► User operator
► Reduce setup time by batching similar jobs
► Automatic job sequencing – automatically transfers
control from one job to another.
► Resident monitor :
► initial control in monitor
► control transfers to job
► when job completes control
►transfers back to monitor
Lahore Garrison University
1
Memory layout of batch 1
systems
Lahore Garrison University
1
2
Batch system (conti…)
Lahore Garrison University
1
3
Multiprogrammed systems
Several jobs are kept in main
memory at the same time, and
the CPU is multiplexed among
them.
Lahore Garrison University
1
4
Multiprogrammed Systems
Example: Two processes P1 and P2 with CPU and
I/O bursts of one time unit each
CPU I/O
Burst Burst
P1
P2
P1
…
P2
Lahore Garrison University
1
Os features needed for 5
Multiprogramming
► Spooling
(Simultaneous
Peripheral Operation
On-Line)(put job in
buffer)
► Memory
management
► CPU scheduling
Lahore Garrison University
1
6
Time sharing systems
► A multi user and multi process
system.
► An interactive system with
multiprogramming
► To obtain a reasonable response time,
jobs may have to be swapped in and
out of main memory.
► UNIX, Linux, Widows NT server, and
Windows 2000 server
Lahore Garrison University
1
7
Real Time systems
► Well-defined fixed-time constraints.
► Often used as a control device in a dedicated
application such as controlling scientific
experiments, medical imaging systems, industrial
control systems, and some display systems. Plane
landing. Ventilators.
► Real-Time systems may be either hard or soft real-
time.
Lahore Garrison University
1
8
Real Time systems
Hard real-time systems:
► Secondary storage limited are absent, data stored in
short term memory, or read-only memory (ROM).coz
time is short
► No virtual memory—time cannot be “wasted” on
translation of logical to physical addresses.
► OS code structured for efficiency
► Plane landing systems, process
control in nuclear power plants,
ventilators, etc.
Lahore Garrison University
1
9
Real time systems (Cont..)
Soft real-time systems
► Output should be produced within the given time
constraints but if it is not, the result is not life
threatening.
► Useful in applications (Live Video Streaming)
requiring advanced operating-system features
Lahore Garrison University
2
Interrupts, Traps and 0
Signals
Interrupt---an event generated by a device in a
computer to get attention of the CPU
Trap—an event by the CPU itself as it executes a
program
Signal—an event generated by a user
Lahore Garrison University
2
1
Interrupts, trap, signals
Interrupt---an event
generated by a device in a
computer to get attention of
the CPU
Trap—an event by the CPU
itself as it executes a
program
Signal—an event generated Answer
by a user
the Phone
.
.
.
Lahore Garrison University
Resume
2
2
Interrupts, trap, signals
► A process can generate a trap, for example, by
dividing a number by zero.
► caused either by an error (division by zero or invalid
memory access) or by a user request for an
operating system service.
► A user or a process may generate a signal (an
interrupt to a process)
Lahore Garrison University
2
3
Interrupt handling
► In case of interrupt or trap, the CPU invokes a piece
of code in the OS to service it, known as interrupt
service routine(ISR) or trap service routine(TSR)
► In case of signal, the process can take one of the
three possible actions , default action as defined by
OS, ignore signal, or take a programmer specified
action
Lahore Garrison University
2
4
Interrupt handling (Cont..)
► Interrupt transfers control to the interrupt service
routine, generally, through the interrupt vector,
which contains addresses of all the interrupt
service routines.
► Interrupt architecture must save the address of the
instruction after the interrupted instruction and the
CPU state so that execution of the interrupted
process may continue after the interrupt has been
serviced.
Lahore Garrison University
2
5
Hardware protection
► Dual-Mode Operation
► I/O Protection
► Memory Protection
► CPU Protection
Lahore Garrison University
2
6
Dual Mode Operation
► Sharing system resources requires operating system
to ensure that an incorrect program cannot cause
other programs to execute incorrectly.
► Provide hardware support to differentiate between at
least two modes of operations.
► User mode – execution done on behalf of a user.
► Monitor mode (also kernel mode or system
mode) – execution done on behalf of operating
system.
Lahore Garrison University
2
7
Dual Mode Operation
► Mode bit added to computer hardware to indicate
the current mode: monitor (0) or user (1).
► When an interrupt or fault occurs hardware switches
to monitor mode.
► Privileged instructions can be issued only in monitor
mode.
Interrupt/fault
monitor user
set user mode
Lahore Garrison University
2
8
Q&A
Lahore Garrison University
2
9
Reference
To cover this topics , different reference material has
been used for consultation.
Operating systems concept by Abraham siberchatz
edition 9
Tutorialspoint.com
Google.com
Lahore Garrison University
3
0
Thank you
Lahore Garrison University