Chapter 2: Operating-System Structures: Silberschatz, Galvin and Gagne ©2013 Operating System Concepts - 9 Edition
Chapter 2: Operating-System Structures: Silberschatz, Galvin and Gagne ©2013 Operating System Concepts - 9 Edition
Chapter 2: Operating-System Structures: Silberschatz, Galvin and Gagne ©2013 Operating System Concepts - 9 Edition
Operating System Concepts – 9th Edition Silberschatz, Galvin and Gagne ©2013
Operating System Services
Operating systems provide an environment for the execution of programs.
Operating systems provides certain services to:
Programs
Users of those programs
Basically two types of services:
services provides functions that are helpful to the user.
services provides functions for ensuring the efficient operation of the system
itself via resource sharing.
Operating System Concepts – 9th Edition 2.2 Silberschatz, Galvin and Gagne ©2013
OS Services Helpful to the User
User interface - Almost all operating systems have a user interface (UI). This interface can take
several forms:
Command-Line (CLI) -- uses text commands.
Graphics User Interface (GUI) -- the interface is a window system + Menus with a pointing
device.
Batch Interface -- commands and directives to control those commands are entered into files,
and those files are executed.
Operating System Concepts – 9th Edition 2.3 Silberschatz, Galvin and Gagne ©2013
OS Services for Ensuring Efficient Operation
Operating System Concepts – 9th Edition 2.4 Silberschatz, Galvin and Gagne ©2013
A View of Operating System Services
Operating System Concepts – 9th Edition 2.5 Silberschatz, Galvin and Gagne ©2013
System Calls (API)
System call is a 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).
Three most common APIs are:
Win32 API for Windows,
POSIX API
Portable Operating System Interface (POSIX)
for POSIX-based systems (including UNIX, Linux, Mac OS X).
Java API for the Java virtual machine (JVM)
Operating System Concepts – 9th Edition 2.6 Silberschatz, Galvin and Gagne ©2013
System Call Implementation
The caller only need to know the API function name and understand
what the OS will do as a result call.
Most details of OS interface hidden from programmer by API.
For example here is a system call of getting the user name of
windows.
https://docs.microsoft.com/en-
us/windows/desktop/api/winbase/nf-winbase-getusernamea
Operating System Concepts – 9th Edition 2.7 Silberschatz, Galvin and Gagne ©2013
System Call -- OS Relationship
The handling of a user application invoking the open() system call
Operating System Concepts – 9th Edition 2.8 Silberschatz, Galvin and Gagne ©2013
Using Windows API with Python
Install the package of
win32api and use it to
make any system call.
Operating System Concepts – 9th Edition 2.9 Silberschatz, Galvin and Gagne ©2013
Types of System Calls
System calls can be grouped roughly into six major categories:
Process control,
File manipulation,
Device manipulation,
Information maintenance,
Communications,
Protection.
Operating System Concepts – 9th Edition 2.10 Silberschatz, Galvin and Gagne ©2013
Examples of
Windows and
Unix System
Calls
Operating System Concepts – 9th Edition 2.11 Silberschatz, Galvin and Gagne ©2013
System Programs
Programs are simply UI and GUI to system calls.
Others are considerably more complex.
Operating System Concepts – 9th Edition 2.12 Silberschatz, Galvin and Gagne ©2013
System Programs (Examples)
File management
e.g windows explorer, open/save window
Status information
date, time, available memory, disk space, number of users
performance, logging, and debugging information.
File modification
Text editors (Notepad)
Search contents of files.
Operating System Concepts – 9th Edition 2.13 Silberschatz, Galvin and Gagne ©2013
System Programs (Examples)
Programming-language support.
Compilers, assemblers, debuggers
Program loading and execution- Absolute loaders, debugging
systems for higher-level and machine language.
Communications
browse web pages (IE, Safari)
send email (outlook)
log in remotely (Remote Desktop)
Operating System Concepts – 9th Edition 2.14 Silberschatz, Galvin and Gagne ©2013
System Programs (Examples)
Background Services
Launch at boot time
Some for system startup, then terminate.
Some from system boot until shutdown.
Run in user context not kernel context
Known as services, subsystems, daemons
Application programs
Run by users
Operating System Concepts – 9th Edition 2.15 Silberschatz, Galvin and Gagne ©2013
Performance Tuning
Improve performance by removing
bottlenecks.
OS must provide tools of displaying
the system behavior.
For example,
Linux: “top” program
Win: "Windows Task Manager"
Operating System Concepts – 9th Edition 2.16 Silberschatz, Galvin and Gagne ©2013
Operating-System Debugging
Debugging is finding and fixing errors, or bugs.
OS generates log files containing error information.
App Failure generates core dump file capturing memory of the
process.
OS failure generates crash dump file containing memory of kernel.
Operating System Concepts – 9th Edition 2.17 Silberschatz, Galvin and Gagne ©2013
System Boot
When system is powered on, then Firmware (in ROM) used to hold
initial boot code.
Small piece of code – bootstrap loader, stored in ROM loads it
into memory, and starts OS
Sometimes two-step process, where boot block at fixed location
loaded by ROM code, which loads bootstrap loader from kernel (in
Disk)
Common bootstrap loader, GRUB, allows selection of kernel from
multiple disks, versions, kernel options.
Operating System Concepts – 9th Edition 2.18 Silberschatz, Galvin and Gagne ©2013
Skip and Read
marks = -1
if(marks < 0 ):
print("less than zero-1")
print("less than zero-1")
We use DEC forprint("less
decimal andthan zero-2")
and HEX for hexadecimal in
MARIE's assembly
language
If you
Operating System Concepts – 9th Edition 2.19 Silberschatz, Galvin and Gagne ©2013