Operating Systems
Chapter 3: Operating Systems
• 3.1 The History of Operating Systems
• 3.2 Operating System Architecture
• 3.3 Coordinating the Machine’s Activities
• 3.4 Handling Competition Among Processes
• 3.5 Security
Copyright © 2015 Pearson Education, Inc. 3-2
Types of Software
• Application software
– Performs specific tasks for users
– e.g., MS word, chrome
• System software
– Provides infrastructure for application software
– Program designed to run a computer's hardware
and applications and manage its resources, such
as its memory, processors, and devices.
– Consists of operating system and utility software
Copyright © 2015 Pearson Education, Inc. 3-3
Operating Systems
❑ A program that acts as an intermediary between
a user of a computer and the computer
hardware.
❑ Operating system goals:
• Execute user programs and make solving user problems
easier.
• Make the computer system convenient to use.
• Use the computer hardware in an efficient manner.
Copyright © 2015 Pearson Education, Inc. 3-4
Four Components of a Computer System
Copyright © 2015 Pearson Education, Inc. 3-5
Different Operating Systems
Copyright © 2015 Pearson Education, Inc. 3-6
Functions of Operating Systems
Copyright © 2015 Pearson Education, Inc. 7
Operating System Structure
• Batch processing
– equires multiprogramming
• Interactive processing
– equires real-time processing
• Time-sharing/Multitasking
– Implemented by Multiprogramming
• Multiprocessor machines
Copyright © 2015 Pearson Education, Inc. 3-8
Figure 3.1 Batch processing
Copyright © 2015 Pearson Education, Inc. 3-9
Figure 3.2 Interactive processing
Copyright © 2015 Pearson Education, Inc. 3-10
Figure 3.3 Software classification
Copyright © 2015 Pearson Education, Inc. 3-11
Operating System Functions
• The initial program that runs when a computer is
powered up is called the bootstrap program, stored in
ROM.
• The process of starting or restarting a computer is called
booting.
Page 400 © 2015 Pearson Education, Inc. Discovering Computers 2012: Chapter 8
Copyright 12
Figure 8-2
Figure 3.4 The booting process
Copyright © 2015 Pearson Education, Inc. 3-13
Getting it Started (Bootstrapping)
• Boot loader: Program in ROM (example of
firmware)
– Run by the CPU when power is turned on
– Transfers operating system from mass storage
to main memory
– Executes jump to operating system
Copyright © 2015 Pearson Education, Inc. 3-14
Operating System Components
• User Interface: Communicates with users
– Text based (Shell)
– Graphical user interface (GUI)
• Kernel: The one program running at all times on
the computer. Performs basic required functions
– File manager
– Device drivers
– Memory manager
– Scheduler and dispatcher
Copyright © 2015 Pearson Education, Inc. 3-15
Figure 3.5 The user interface act as an
intermediary between users and the
operating system kernel
Copyright © 2015 Pearson Education, Inc. 3-16
File Manager
• Directory (or Folder): A user-created
bundle of files and other directories
(subdirectories)
• Directory Path: A sequence of directories
within directories
Copyright © 2015 Pearson Education, Inc. 3-17
Memory Manager
• Allocates space in main memory
• May create the illusion that the machine
has more memory than it actually does
(virtual memory) by playing a “shell
game” in which blocks of data (pages) are
shifted back and forth between main
memory and mass storage
Copyright © 2015 Pearson Education, Inc. 3-18
Processes
• Process: The activity of executing a
program
• Process Table: To keep track of all the
processes, the scheduler maintains a block
of information in main memory.
– Program counter
– General purpose registers
– Related portion of main memory
Copyright © 2015 Pearson Education, Inc. 3-19
Process State
• A process changes its state during its execution.
Each process may be in one of the following
states:
• New: when a new process is being created.
• Running: A process is said to be in running state
when instructions are being executed.
• Waiting: The process is waiting for some event to
occur (such as an I/O operation).
• Ready: The process is waiting for processor.
• Terminated: The process has finished execution.
Copyright © 2015 Pearson Education, Inc. 3-20
Process State Diagram
Copyright © 2015 Pearson Education, Inc. 3-21
Process Administration
• Scheduler: Adds new processes to the
process table and removes completed
processes from the process table.
– Responsible for determining which process
should run next on the CPU.
• Dispatcher: Controls the allocation of time
slices to the processes in the process table
– The end of a time slice is signaled by an
interrupt.
Copyright © 2015 Pearson Education, Inc. 3-22
Figure 3.6 Time-sharing between
process A and process B
Copyright © 2015 Pearson Education, Inc. 3-23
Handling Competition for Resources
• Semaphore: A “control flag”, used to
control access to shared resources.
• Critical Region: A group of instructions
that should be executed by only one
process at a time.
• Mutual exclusion: The requirement that
only one process at a time be allowed to
execute a critical region.
Copyright © 2015 Pearson Education, Inc. 3-24
Handling Competition for Resources
• A common way of obtaining mutual
exclusion to a critical region is to guard the
critical region with a semaphore.
• To enter the critical region, a process must
find the semaphore clear and then set the
semaphore before entering the critical
region.
• Upon exiting the critical region, the process
must clear the semaphore.
Copyright © 2015 Pearson Education, Inc. 3-25
Deadlock Occurrence
Copyright © 2015 Pearson Education, Inc. 3-26
Deadlock
• The condition in which two or more
processes are blocked from progressing
because each is waiting for a resource that
is allocated to another.
• Conditions required for deadlock
1. Competition for non-sharable resources
2. Resources requested on a partial basis
3. An allocated resource can not be forcibly
retrieved
Copyright © 2015 Pearson Education, Inc. 3-27
Figure 3.7 A deadlock resulting from
competition for nonshareable railroad
intersections
Copyright © 2015 Pearson Education, Inc. 3-28
Security
• Attacks from outside
– Problems
• Insecure passwords
• Sniffing software
– Counter measures
• Auditing software
Copyright © 2015 Pearson Education, Inc. 3-29
Security (continued)
• Attacks from within
– Problem: Unruly processes
– Counter measures: Control process activities
via privileged modes and privileged
instructions
Copyright © 2015 Pearson Education, Inc. 3-30