TFCS 2
TFCS 2
▸ Three most common APIs are Win32 API for Windows, POSIX API for POSIX-
based systems (including virtually all versions of UNIX, Linux, and Mac OS
X), and Java API for the Java virtual machine (JVM)
(Note that the system-call names used throughout this text are generic)
The system call interface invokes intended system call in OS kernel and returns
status of the system call and any return values
The caller need know nothing about how the system call is implemented
Just needs to obey API and understand what OS will do as a result call
Most details of OS interface hidden from programmer by API
• Managed by run-time support library (set of functions built into libraries
included with compiler)
C program invoking printf() library call, which calls write() system call
Single-tasking
Shell invoked when system booted
Simple method to run program
No process created
Single memory space
Loads program into memory, overwriting all but the kernel
Program exit -> shell reloaded
Unix variant
Multitasking
User login -> invoke user’s choice of shell
Shell executes fork() system call to create process
Executes exec() to load program into process
Shell waits for process to terminate or continues with
user commands
Process exits with code of 0 – no error or > 0 – error
code
File management - Create, delete, copy, rename, print, dump, list, and
generally manipulate files and directories
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
A virtual machine takes the layered approach to its logical conclusion. It treats
hardware and the operating system kernel as though they were all hardware.
The operating system host creates the illusion that a process has its own
processor and (virtual memory).
42
The Java Virtual Machine
43
Operating-System Debugging
45
Operating System Generation
Bootstrap program – code stored in ROM that is able to locate the kernel, load
it into memory, and start its execution
46
End of Chapter 2