Introduction
Introduction
Introduction
Operating System Concepts – 9th Edit9on Silberschatz, Galvin and Gagne ©2013
Introduction
What Operating Systems Do?
Computer-System Organisation
Computer-System Architecture
Operating-System Structure
Operating-System Operations
Computing Environments
Operating System Services
System Calls and its types
Operating System Concepts – 9th Edition 1.2 Silberschatz, Galvin and Gagne ©2013
Objectives
Operating System Concepts – 9th Edition 1.3 Silberschatz, Galvin and Gagne ©2013
What is an Operating System?
Operating System Concepts – 9th Edition 1.4 Silberschatz, Galvin and Gagne ©2013
Four Components of a Computer System
Operating System Concepts – 9th Edition 1.5 Silberschatz, Galvin and Gagne ©2013
What Do Operating Systems Do
Operating System Concepts – 9th Edition 1.6 Silberschatz, Galvin and Gagne ©2013
Operating System Definition
OS is a resource allocator
Manages all resources
Decides between conflicting requests for efficient and
fair resource use
OS is a control program
Controls execution of programs to prevent errors and
improper use of the computer
Operating System Concepts – 9th Edition 1.7 Silberschatz, Galvin and Gagne ©2013
Operating System Definition (Cont.)
Operating System Concepts – 9th Edition 1.8 Silberschatz, Galvin and Gagne ©2013
Computer System Organization
Computer-system operation
One or more CPUs, device controllers connect through common
bus providing access to shared memory
Concurrent execution of CPUs and devices competing for
memory cycles
Operating System Concepts – 9th Edition 1.9 Silberschatz, Galvin and Gagne ©2013
Computer-System Architecture
Operating System Concepts – 9th Edition 1.10 Silberschatz, Galvin and Gagne ©2013
A Dual-Core Design
Multi-chip and multicore
Systems containing all chips
Chassis containing multiple separate systems
Operating System Concepts – 9th Edition 1.11 Silberschatz, Galvin and Gagne ©2013
Symmetric Multiprocessing Architecture
Operating System Concepts – 9th Edition 1.12 Silberschatz, Galvin and Gagne ©2013
Operating System Structure
Multiprogramming (Batch system) needed for efficiency
Single user cannot keep CPU and I/O devices busy at all times
Multiprogramming organizes jobs (code and data) so CPU always has one
to execute
A subset of total jobs in system is kept in memory
One job selected and run via job scheduling
When it has to wait (for I/O for example), OS switches to another job
Operating System Concepts – 9th Edition 1.13 Silberschatz, Galvin and Gagne ©2013
Memory Layout for Multiprogrammed System
Operating System Concepts – 9th Edition 1.14 Silberschatz, Galvin and Gagne ©2013
How a Modern Computer Works
Operating System Concepts – 9th Edition 1.15 Silberschatz, Galvin and Gagne ©2013
Operating-System Operations
Interrupt driven (hardware and software)
Hardware interrupt by one of the devices
Software interrupt (exception or trap):
Software error (e.g., division by zero)
Operating System Concepts – 9th Edition 1.16 Silberschatz, Galvin and Gagne ©2013
Common Functions of Interrupts
Operating System Concepts – 9th Edition 1.17 Silberschatz, Galvin and Gagne ©2013
Interrupt Handling
Operating System Concepts – 9th Edition 1.18 Silberschatz, Galvin and Gagne ©2013
I/O Structure
After I/O starts, control returns to user program only upon I/O
completion
Wait instruction idles the CPU until the next interrupt
Wait loop (contention for memory access)
At most one I/O request is outstanding at a time, no
simultaneous I/O processing
After I/O starts, control returns to user program without waiting
for I/O completion
System call – request to the OS to allow user to wait for
I/O completion
Device-status table contains entry for each I/O device
indicating its type, address, and state
OS indexes into I/O device table to determine device
status and to modify table entry to include interrupt
Operating System Concepts – 9th Edition 1.19 Silberschatz, Galvin and Gagne ©2013
Operating-System Operations (cont.)
Operating System Concepts – 9th Edition 1.20 Silberschatz, Galvin and Gagne ©2013
Transition from User to Kernel Mode
Timer to prevent infinite loop / process hogging resources
Timer is set to interrupt the computer after some time period
Keep a counter that is decremented by the physical clock.
Operating system set the counter (privileged instruction)
When counter zero generate an interrupt
Set up before scheduling process to regain control or terminate
program that exceeds allotted time
Operating System Concepts – 9th Edition 1.21 Silberschatz, Galvin and Gagne ©2013
A View of Operating System Services
Operating System Concepts – 9th Edition 2.22 Silberschatz, Galvin and Gagne ©2013
Operating System Services
Operating systems provide an environment for execution of programs
and services to programs and users
One set of operating-system services provides functions that are
helpful to the user:
User interface - Almost all operating systems have a user
interface (UI).
Varies between Command-Line (CLI), Graphics User
Interface (GUI), Batch
Program execution - The system must be able to load a
program into memory and to run that program, end execution,
either normally or abnormally (indicating error)
I/O operations - A running program may require I/O, which may
involve a file or an I/O device
Operating System Concepts – 9th Edition 2.23 Silberschatz, Galvin and Gagne ©2013
Operating System Services (Cont.)
Operating System Concepts – 9th Edition 2.24 Silberschatz, Galvin and Gagne ©2013
Operating System Services (Cont.)
Another set of OS functions exists for ensuring the efficient operation of the
system itself via resource sharing
Resource allocation - When multiple users or multiple jobs running
concurrently, resources must be allocated to each of them
Many types of resources - CPU cycles, main memory, file storage,
I/O devices.
Accounting - To keep track of which users use how much and what
kinds of computer resources
Protection and security - The owners of information stored in a
multiuser or networked computer system may want to control use of
that information, concurrent processes should not interfere with each
other
Protection involves ensuring that all access to system resources is
controlled
Security of the system from outsiders requires user authentication,
extends to defending external I/O devices from invalid access
attempts
Operating System Concepts – 9th Edition 2.25 Silberschatz, Galvin and Gagne ©2013
A View of Operating System Services
Operating System Concepts – 9th Edition 2.26 Silberschatz, Galvin and Gagne ©2013
User Operating System Interface - CLI
Operating System Concepts – 9th Edition 2.27 Silberschatz, Galvin and Gagne ©2013
User Operating System Interface - GUI
Operating System Concepts – 9th Edition 2.28 Silberschatz, Galvin and Gagne ©2013
A View of Operating System Services
Operating System Concepts – 9th Edition 2.29 Silberschatz, Galvin and Gagne ©2013
System Calls
Programming interface to the services provided by the OS
Typically written in a high-level language (C or C++)
Mostly accessed by programs via a high-level
Application Programming Interface (API) rather than
direct system call use
Three most common APIs are Win32 API for Windows,
POSIX API for POSIX-based systems (including virtually
all versions of UNIX, Linux, and Mac OS X), and Java API
for the Java virtual machine (JVM)
Operating System Concepts – 9th Edition 2.30 Silberschatz, Galvin and Gagne ©2013
System Call Implementation
Operating System Concepts – 9th Edition 2.31 Silberschatz, Galvin and Gagne ©2013
API – System Call – OS Relationship
Operating System Concepts – 9th Edition 2.32 Silberschatz, Galvin and Gagne ©2013
Types of System Calls
Process control
create process, terminate process
end, abort
load, execute
get process attributes, set process attributes
wait for time
wait event, signal event
allocate and free memory
Dump memory if error
Debugger for determining bugs, single step execution
Locks for managing access to shared data between processes
Operating System Concepts – 9th Edition 2.33 Silberschatz, Galvin and Gagne ©2013
Types of System Calls
File management
create file, delete file
open, close file
read, write, reposition
get and set file attributes
Device management
request device, release device
read, write, reposition
get device attributes, set device attributes
logically attach or detach devices
Operating System Concepts – 9th Edition 2.34 Silberschatz, Galvin and Gagne ©2013
Course Logistics
Lecture on Monday
2 hours labs on the following days in the same week
Java is the main programming language. No need to panic as there won’t
be programming assessment for this unit. It is meant to help you understand
the contents/algorithms better for the OS concept.
Operating System Concepts – 9th Edition 2.35 Silberschatz, Galvin and Gagne ©2013
Assessment
One piece of assessment (100% weighting)
Quiz test on Moodle, 90 minutes single attempt
20 quiz questions
15 single choice ones (2.5 marks each)
5 Descriptive ones (12.5 marks each)
Operating System Concepts – 9th Edition 2.36 Silberschatz, Galvin and Gagne ©2013