Ch2 Exit and Ch3
Ch2 Exit and Ch3
System Calls
System Services
Linkers and Loaders
Why Applications are Operating System Specific
Design and Implementation
Operating System Structure
Building and Booting an Operating System
Operating System Debugging
Objectives
Note that the system-call names used throughout this text are
generic
Example of System Calls
System call sequence to copy the contents of one file to another file
Example of Standard API
System Call Implementation
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
Types of System Calls (Cont.)
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
Types of System Calls (Cont.)
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
Types of System Calls (Cont.)
Protection
• Control access to resources
• Get and set permissions
• Allow and deny user access
Examples of Windows and Unix System Calls
Standard C Library Example
C program invoking printf() library call, which calls write() system call
Example: Arduino
Single-tasking
No operating system
Programs (sketch) loaded via
USB into flash memory
Single memory space
Boot loader loads program
Program exit -> shell
reloaded
Status information
• Some ask the system for info - date, time, amount of available
memory, disk space, number of users
• Others provide detailed performance, logging, and debugging
information
• Typically, these programs format and print the output to the
terminal or other output devices
• Some systems implement a registry - used to store and
retrieve configuration information
System Services (Cont.)
File modification
• Text editors to create and modify files
• Special commands to search contents of files or perform
transformations of the text
Programming-language support - Compilers, assemblers,
debuggers and interpreters sometimes provided
Program loading and execution- Absolute loaders, relocatable
loaders, linkage editors, and overlay-loaders, debugging systems for
higher-level and machine language
Communications - Provide the mechanism for creating virtual
connections among processes, users, and computer systems
• Allow users to send messages to one another’s screens, browse
web pages, send electronic-mail messages, log in remotely,
transfer files from one machine to another
System Services (Cont.)
Background Services
• Launch at boot time
Some for system startup, then terminate
Some from system boot to shutdown
Source code compiled into object files designed to be loaded into any
physical memory location – relocatable object file
Linker combines these into single binary executable file
• Also brings in libraries
Program resides on secondary storage as binary executable
Must be brought into memory by loader to be executed
• Relocation assigns final addresses to program parts and adjusts
code and data in program to match those addresses
Modern general purpose systems don’t link libraries into executables
• Rather, dynamically linked libraries (in Windows, DLLs) are
loaded as needed, shared by all that use the same version of that
same library (loaded once)
Object, executable files have standard formats, so operating system
knows how to load and start them
The Role of the Linker and Loader
Why Applications are Operating System Specific