CH 1
CH 1
interrupts
▪ Illustrate how system calls are used to provide operating system services
▪ Today’s OSes for general purpose and mobile computing also include
middleware – a set of software frameworks that provide additional
services to application developers such as databases, multimedia,
graphics
▪ Computer-system operation
• One or more CPUs, device controllers connect through common bus
providing access to shared memory
Device controllers It’s a small electronic part that knows how to
speak the device’s language
The CPU sends commands, and the device controller makes
sure the connected device understands them.
Example:
CPU: "Hey printer, print this!"
Device controller: "Alright, let me tell the
printer to do that and get back to you."
▪ Device controller informs CPU that it has finished its operation by causing
an interrupt
Operating System 1.9
Computer-System Operation
▪ Example
▪ The device driver initializes an
I/O operation by loading
appropriate registers in the
device controller.
▪ The device controller checks the
registers to decide the required
action (e.g., read a character
from the keyboard).
▪ The controller transfers data
from the device to its local buffer.
▪ Once the transfer is complete,
the device controller notifies the
device driver.
▪ The device driver hands control
back to the operating system,
potentially providing the data or
its pointer for further use. Interrupt-drive I/O Cycle
Operating System 1.10
Common Functions of Interrupts
Main memory
HDD SSD
The basic unit of computer storage is the bit. A bit can contain one of two
values, 0 and 1. All other storage in a computer is based on collections of bits.
Given enough bits, it is amazing how many things a computer can represent:
numbers, letters, images, movies, sounds, documents, and programs, to name
a few. A byte is 8 bits, and on most computers it is the smallest convenient
chunk of storage. For example, most computers don’t have an instruction to
move a bit but do have one to move a byte. A less common term is word,
which is a given computer architecture’s native unit of data. A word is made
up of one or more bytes. For example, a computer that has 64-bit registers and
64-bit memory addressing typically has 64-bit (8-byte) words. A computer
executes many operations in its native word size rather than a byte at a time.
▪ A single user or task (like printing a file) cannot always keep the CPU and devices
▪ Multiprogramming keeps multiple tasks (jobs) ready so the CPU always has
something to do.
▪ Note: Both multiprogramming and multitasking can execute more than one jobs,
but a specific time is allotted to every process in multitasking that causes other
process to wait while one is being executed. This is referred to as time sharing
system. In both of the processes, the waiting time and response time is reduced to
a great extent.
▪ File-System management
• Files usually organized into directories
• Access control on most systems to determine who can access
what
• OS activities include
Creating and deleting files and directories
Primitives to manipulate files and directories
Mapping files onto secondary storage
Backup files onto stable (non-volatile) storage media
▪ Virtualization:
• Allows multiple operating systems (OSes) to run on the same hardware
simultaneously.
• Example: Running Windows XP inside Windows 10 using VMware.
▪ Emulation:
• Used when the source CPU type (e.g., PowerPC) is different from the
target CPU type (e.g., Intel x86).
• Converts instructions from one CPU type to another but is generally
slower.
▪ How Virtualization Works:
• The host OS runs a Virtual Machine Manager (VMM), which provides
virtualization services.
• The VMM creates virtual machines (VMs) that allow guest OSes to
run as if they have their own hardware.
• Both the host OS and guest OSes are natively compiled for the same
CPU.
Operating System 1.32
Computing Environments - Virtualization
Core
▪ System call sequence to copy the contents of one file to another file
• cp in.txt out.txt
▪ 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
▪ 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
▪ Information maintenance
• get time or date, set time or date
• get system data, set system data
• get and set process, file, or device attributes
▪ Communications
• create, delete communication connection
• send, receive messages if message passing model to host
name or process name
From client to server
• Shared-memory model create and gain access to memory
regions
• transfer status information
• attach and detach remote devices
▪ Protection
• Control access to resources
• Get and set permissions
• Allow and deny user access