Chapter 1
Chapter 1
INTRODUCTION
What is an Operating System?
A program that acts as an intermediary between a computer user and the
computer hardware
High level interface between user and machine
OS is a control program
Controls the execution of the programs to prevent errors and improper use of the
computer
“The one program running at all times on the computer” is the kernel. Everything
else is either a system program or an application program.
System Boot
Bootstrap program is loaded at power-up or reboot
Typically stored in ROM or EEPROM, generally known as firmware
Initializes all aspects of system
Locates and loads operating system kernel into memory and starts execution
Sometimes two-step process where boot block at fixed location loaded by ROM
code, which loads bootstrap loader from disk
However what will happen if while handling an interrupt, another interrupt triggers?
Context switches are usually computationally intensive and much of the design of
operating systems is to optimize the use of context switches
Operating-System Operations
Interrupt driven by hardware
Software error or request creates exception or trap
Division by zero, request for operating system service
Other process problems include infinite loop, processes modifying each other or the
operating system
Dual-mode operation allows OS to protect itself and other system components
User mode and Kernel mode
Mode bit provided by hardware
Provides ability to distinguish when system is running user code or kernel code
Some instructions designated as privileged, only executable in kernel mode
– System call changes mode to kernel, return from call resets it to user
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
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
Evolution of Operating Systems
The main objective of real-time operating systems is their quick and predictable
response to events.
This type of operating systems are mostly used in desktop or/and laptop computers
today.
Microsoft's Windows and Apple's Mac OS platforms are both examples of
operating systems that will let a single user have several programs in operation at
the same time.
Multi-user OS
A multi-user operating system allows many different users to use computer's resources
simultaneously.
Various users should be balanced, and that each of the programs they are
using/executing has sufficient and separate resources.
For example Unix, VMS and mainframe operating systems, are examples of multi-user
operating systems.
Mobile OS
It has built-in support for mobile multimedia formats. Tablet PCs and smart
phones run on mobile operating systems.
Computer-System Architecture
Most systems contain a single general-purpose processor
Few systems contain special-purpose processors as well
Distributed computing
Collection of separate, possibly heterogeneous, systems networked together
Network is a communications path, TCP/IP most common
– Local Area Network (LAN)
– Wide Area Network (WAN)
– Metropolitan Area Network (MAN)
– Personal Area Network (PAN)
Network Operating System provides features between systems across network
Communication scheme allows systems to exchange messages
Illusion of a single system
Computing Environments – Client-Server
Client-Server Computing
Dumb terminals supplanted by smart PCs
Many systems now servers, responding to requests generated by clients
Compute-server system provides an interface to client to request services
(i.e., database)
File-server system provides interface for clients to store and retrieve files
Computing Environments - Peer-to-Peer
Multiprocessing
Multiprocessing is the use of two or more CPUs within a single computer system
Symmetric and asymmetric multiprocessing
Multitasking
There is only one processor and one user.
User can activate more than one program/task at a time.
OS schedule multiple jobs for their fair share processing.
Multithreading
Execute different parts of a program called threads at the same time
Threads: The light wait processes which are independent part of a process or program.
Comparison
Multithreading System