Upload
maud-mclaughlin
View
221
Download
0
Tags:
Embed Size (px)
Citation preview
OperatingSystems
David Goldschmidt, Ph.D.Computer Science
The College of Saint Rose
CIS 432
Operating System Services
An operating system provides services to its users: Program execution
Load programs into memory, run/suspend/halt programs, handle/display errors
I/O operations Seamlessly interact with I/O devices, including
disks, networks connection, etc. Filesystem manipulation
Read/write/traverse filesystem directories,read/write files, enforce permissions, search for files, etc.
Operating System Services
Other services an operating system provides: Inter-Process Communications (IPC)
Processes exchange information via shared memory,message passing, sockets, pipes, files, etc.
Might span multiple computer systems Error detection and recovery
Errors arise in CPU, memory, I/O devices,processes, etc.
Operating system should detect and recover from errors, ensuring correct and consistent operations
Operating System Structure
Using a layered approach, the operating system is divided into N levels or layers Layer 0 is the hardware Layer N is the top-level
user interface Each layer uses functions
and services of lower layers Layer 1 often is the kernel
Operating System Structure
Operating System Kernel
The core program running in anoperating system is the kernel When a computer is switched on,
a bootstrap program executes from ROM Bootstrap program initializes all aspects of
the system, then loads the operating system kernel and starts its execution
User and Kernel Modes
Dual-mode operation provides a user mode anda kernel mode of operation Allows the operating system to protect
itself and other system components
User and Kernel Modes
Kernel relinquishes control to a user process,but may set a timer to ensure a process does not run beyond its allotted time Avoid infinite loops, memory leaks,
memory hogs, etc. Not entirely effective in practice?
How many times have you fought to stop a runaway process?
Kernel also provides securityvia privileged instructions
System Calls via APIs
Operating system services available to usersvia GUI and CLI, which are just software programs System calls are made via programming interface
called an Application Program Interface (API) Common operating system APIs:
Win32 API for Windows POSIX API for POSIX-based systems,
including UNIX, Linux, Mac OS X Java API for Java Virtual Machine C++ Standard Library
System Calls via APIs
Types of system calls include: Process control (e.g. start/suspend/stop a
process) Debugging information, too
File management Device management Information retrieval and maintenance
Current date/time, number of current users, OS version, amount of free memory, process information, etc.
Communications (e.g. IPC, network)
System Calls via APIs
System call sequence for a file copy program:
System Calls via APIs
An API successfully hides the implementation detailsof the operating system Programmers just need to abide by
the API specifications Change the operating system,
but maintain the API such thatit is backwards compatible Deprecate old behavior over
long period of time Why?
hey, the dude abides, man
System Calls via APIs
System Calls via APIs
Example using theprintf() functionfrom C
One API may callanother, which maycall another, etc.
System Calls via APIs
Pass parameters to the operating systemvia registers or a block of data in memory