5 - System Calls Flashcards
What are system calls used for?
When the application wants to access a system service/resource
What is a trap?
A special CPU instruction
Switches from user to kernel mode
Invokes a trap handler, registered by kernel
What happens inside a trap handler?
- OS saves application state
- OS does the requested operation, eg. involving some hardware
- OS switches back to user mode and restores application state
How many system calls could a typical OS be executing per second?
1000s
What language are system calls typically implemented in and why?
Assembly - Optimized for performance
Are system calls usually made directly by the application?
No - Usually wrapped in libraries
Why are system calls typically made using library wrapper functions?
Hides the implementation details
Easier to port to other systems
that support the same APIs
Still works if system call is deprecated or changes
List some common system call APIs
POSIX for Unix, Linux, Mac OS X
Win32 for Windows
Java APIs for JAVA VM
What is a system call table?
A table of all system calls, indexed by a unique number associated with each system call.
What system call can you use to trace system calls?
strace
How do you get more information about system calls?
man pages
e.g., man strace
What is a process?
A program in execution
A container of information needed by an OS to run a program
What is a process tree?
The idea that processes can create new child processes and so in in a tree like way (Only one parent)
What are Pipes?
A mechanism for letting two processes communicate with eachother.
What does IPC stand for?
Inter-process communication