PT Rev
PT Rev
PT Rev
HIERARCHY
MODERN COMPUTERS
I. Peopleware – Us
II. Software – serves as the platform for the A modern computer consists of:
hardware
o One or more processors
III. Hardware – physical aspects
o Main memory
TWO TYPES OF SOFTWARE: o Disks
o Printers
Application Software
o Various input/output devices
Multimedia
Enterprise o AVR, mouse, keyboard, system unit, monitor, etc.
Productivity • Managing all these components requires a layer of
Educational software — the OPERATING SYSTEM
System Software
Operating System HARDWARE ARCHITECTURE – A set of disciplines that
Driver’s/Device System describes a computer system by specifying its parts and
Utility System their relations provides physical environment.
Common Types:
PLATFORM o Commodity computing platforms
In general, a computing platform is any pre-existing o Video game consoles
hardware environment, a piece of software that is o RISC
designed to run within it, and any associated facilities o Midrange computers
used with it. o Mainframe computers
A platform is any base of technologies on which other o Supercomputer
technologies or processes are built; support the
creation of other technologies
Most services that the end users use will be build on OPERATING SYSTEMS
top of platforms.
• A collection of software that manages computer
hardware resources and provides common services for
computer programs.
GENERATIONS OF COMPUTING (VTIPM)
• It is an essential component of the system software in a
1. (1945–55) Vacuum Tubes (15) computer system.
• Application programs usually require an operating
• Punch cards and machine language programming system to function.
2. (1955–65) Transistors and Batch Systems (15) • The most important program that runs on your
computer.
• Mainframes (IBM 1401,IBM 7094), FORTRAN compiler • It manages all other programs on the machine.
3. (1965–1980) ICs and Multiprogramming (20) • Every PC has to have one to run other applications or
programs.
• IBM System/360,OS/360, multiprogramming, • It’s the first thing “loaded”.
timesharing, MULTICS • In simple terms, an operating system is a manager.
• It manages all the available resources on a computer,
4. (1980–Present)Personal Computers (10)
from the CPU, to memory, to hard disk accesses.
• IBM PC, DOS, Macintosh, Windows, Linux • Major cost of general purpose computing is software.
• An operating system is a program that acts as an
5. (1990–Present)Mobile Computers (10)
intermediary between the user of a computer and
• PDAs, SymbianOS, Blackberry OS, Smartphones, iOS, computer hardware.
Android • Operating systems simplify and manage the complexity
of running application programs efficiently.
• Operating systems turn the ugly hardware details into
TRANSISTORS AND BATCH SYSTEMS beautiful abstractions for the use of other software.
• 1965: less expensive DEC minicomputers introduced 4. DATA MANAGEMENT AND STORAGE – hard drives,
flash drives, compact disks, etc.
Personal computer era: 1981 to present
• Database software: IBM (DB2),Oracle, Microsoft (SQL
• 1981: Introduction of IBM PC
Server), Sybase (Adaptive Server Enterprise), MySQL
• Proliferation in 80s, 90s resulted in growth of personal
• Physical data storage: EMC Corp (large-scale systems),
software
Seagate, Maxtor, Western Digital
Client/server era: 1983 to present
• STORAGE AREA NETWORKS(SANS): Connect multiple
• Desktop clients networked to servers, with processing storage devices on dedicated network
work split between clients and servers
Cloud and Mobile Computing: 2000 to present • Network hardware providers: Cisco, Alcatel-
Lucent,Nortel, Juniper Networks
• CLOUD COMPUTING: computing power and software
applications supplied over the Internet or other network
6. INTERNET PLATFORMS – search engines
• Server level: 65%run Unix or Linux; 35%run Windows • Accenture, IBM Global Services, EDS, Infosys, Wipro
CHAPTER 2: PROCESSES
© claiming uno for ebriwan – misyel
PROCESSES Another instances:
A process is an abstraction of a running program If a peripheral device is inserted (e.g. USB) while a
It enables doing several things at the same time process is ongoing, another process will be
support the ability to have (pseudo) concurrent created
operation Simply booting up the PC
Example: Consider a User PC
•In all these cases, a new process is created by having an
• In a MULTIPROGRAMMING system, the CPU switches existing process execute a PROCESS CREATION system
from process to process quickly, running each for tens or call.
hundreds of milliseconds
PROCESS TERMINATION
DIFFERENCES:
Events which cause process termination:
• A PROCESS is an activity of some kind; simply a running
1. Normal exit (voluntary).
program
2. Error exit(voluntary).
• A PROGRAM is something that may be stored on disk, 3. Fatal error (involuntary).
not doing anything; set of instructions 4. Killed by another process(involuntary).
MULTIPROGRAMMING - allows our CPU to work than User uses a task manager
one or multiple processes at a time, but not Plug out the PC
simultaneously (runs in parallel); one CPU or single
processor, multiple process in a parallel manner
PROCESS STATES
MULTIPROCESSING - multiple processors that can run
multiple processes at the same time Three states a process may be in:
PROCESS CREATION
RACE CONDITIONS – Two or more processes are reading Execution states of a process: Running, ready, waiting
or writing some shared data and the final result depends
How does a process move from one state to another?
on who runs precisely when; two process communicate
with each other • Scheduling, I/O, creation, termination
Example: two processes want to access the printer How are processes created?
spooler directory at the same time
• Create Process (Windows), fork/exec (Unix)
Conditions Required to Avoid Race Condition
2. No assumptions may be made about speeds or the The OPERATING SYSTEM as a large multithreaded
number of CPUs. – No Assumption program
Each process executes as a thread within the OS
3. No process running outside its critical region may block Multithreading is very useful for applications
other processes. – Progress Efficient multithreading requires fast primitives
Processes are too heavyweight
4. No process should have to wait forever to enter its
Solution is to separate threads from processes
critical region. – No Starvation
Kernel-level threads much better, but still
significant overhead
User-level threads even better, but not well
Mutual Exclusion using Critical Regions
integrated with OS
• CRITICAL REGION – the part of the program where
shared variables are accessed
CHAPTER 3: SCHEDULING
PROCESS BEHAVIOUR
Mutual Exclusion with Busy Waiting
a) CPU-bound processes spend most of their time
DISABLING INTERRUPTS
computing
Each process disables all interrupts just after entering b) I/O bound processes spend most of their time
its critical region and re-enable them just before waiting for I/O
leaving it
In a multicore (i.e., multiprocessor system) disabling
the interrupts of one CPU does not prevent other MULTIPROGRAMMING
CPUs from interfering with operations the first CPU is
• Overlapping I/O and CPU activities
performing
o To increase CPU utilization and job
LOCK VARIABLES
throughput
A single, shared (lock) variable, process sets it to 1
• Previously covered the mechanisms of
and enters the critical region. If the lock is already 1,
the process just waits until it becomes 0. o Context switching
Has the same fatal flaw that we saw in the spooler o Process queues and process states
directory.
• which process(thread) to run, for how long, etc. –
STRICT ALTERNATION SCHEDULING
two processes strictly alternate in entering their
critical regions
it is not really a serious candidate as a solution SCHEDULING
because it violates condition 3 Choosing which process to run next, when two or
PETERSON’S SOLUTION more of them are simultaneously in the ready state
Deciding which process should occupy the resource
THE TSL INSTRUCTION (CPU, disk, etc.)
Done by scheduler using the scheduling algorithm
Many of the same issues that apply to process
Process Summary scheduling also apply to thread scheduling, although
some are different.
PROCESSES – units of execution
JOBS - schedulable entities (processes, threads)
PROCESS CONTROL BLOCKS (PCBs) – how those units of
execution represented
Real-time Systems
SCHEDULING OBJECTIVES MEETING DEADLINES - avoid losing data
Fair - Everyone is happy PREDICTABILITY - avoid quality degradation in
Priority - Some are more important multimedia systems
Efficiency - Make best use of equipment
Encourage good behavior - Good boy/girl
Support heavy load - Degrade gracefully SCHEDULING ALGORITHMS
Adapt to different environment - Interactive,
BATCH SYSTEMS:
real-time, multi-media
a) FIRST-COME, FIRST-SERVED (FCFS)
“Real-world” scheduling of people in lines (e.g.,
CATEGORIES OF SCHEDULING ALGORITHMS supermarket)
A single queue of ready jobs
1. BATCH
Jobs are scheduled in order of arrival to ready queue
Periodic tasks – payroll, bills, interest calculation Typically non-preemptive (no context switching at
(at banks) market)
No users impatiently waiting Jobs treated equally, no starvation.
Possible to run for long time periods for each When the running process blocks, the first process
process without switching on the queue is run next.
When a blocked process becomes ready, like a newly
2. INTERACTIVE arrived job, it is put on the end of the queue, behind
For environments with interactive users – all waiting processes.
personal computing, servers Problems
One process cannot be hogging the CPU and
denying service to the others Average waiting time can be large
If small jobs wait behind long ones (high
3. REAL-TIME turnaround time)
Only programs that are intended to further the Non-preemptive
application at hand
Processes may not run for long and usually do
their work and block quickly, so it’s okay to let b) SHORT JOB FIRST(SJF)
them finish Choose the job with the smallest expected duration
first
o Person with smallest number of items to buy
Preemptive Vs. Non-preemptive Requirement: the job duration needs to be known in
advance
NON-PREEMPTIVE SCHEDULING – The running process Used in Batch Systems
keeps the CPU until it voluntarily gives up the CPU Optimal for Average Waiting Time if all jobs are
available simultaneously
© claiming uno for ebriwan – misyel
Problems Various algorithms to meet these goals: FCFS/FIFO,SJF,
RR, Priority
STARVATION – a job is waiting forever
All jobs must be available at start – Suited for MULTIPLE-LEVEL FEEDBACK QUEUES - can combine
batch systems algorithms
c) MULTI-QUEUE & MULTI-LEVEL FEEDBACK Think of a DISK as a linear sequence of fixed-size blocks
Scheduling algorithms can be combined and supporting two operations:
o Have multiple queues
Read block k
o Use a different algorithm among queues
Write block k
o Move processes among queues
Multiple queues representing different job types For large systems, few of the questions that quickly arise:
o Interactive, CPU-bound, batch, etc.
How do you find information?
o Queues have priorities
How do you keep one user from reading another
o Jobs can move among queues based upon
user’s data?
execution history How do you know which blocks are free?
For users, they provide a structured way to organize UNIX I-NODES – implement an indexed structure for files
files
• Each I-NODE contains number of file block pointers
For the file system, they provide a convenient
naming interface that allows the implementation to • Last block points to a block containing more disk-block
separate logical file organization from physical file addresses
placement on the disk
Most file systems support multi-level directories
Naming hierarchies (/, /usr, /usr/local/, …) SHARING FILES BETWEEN DIRECTORIES