5 - System Calls Flashcards

1
Q

What are system calls used for?

A

When the application wants to access a system service/resource

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a trap?

A

A special CPU instruction
Switches from user to kernel mode
Invokes a trap handler, registered by kernel

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What happens inside a trap handler?

A
  1. OS saves application state
  2. OS does the requested operation, eg. involving some hardware
  3. OS switches back to user mode and restores application state
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How many system calls could a typical OS be executing per second?

A

1000s

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What language are system calls typically implemented in and why?

A

Assembly - Optimized for performance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Are system calls usually made directly by the application?

A

No - Usually wrapped in libraries

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Why are system calls typically made using library wrapper functions?

A

Hides the implementation details
Easier to port to other systems
that support the same APIs
Still works if system call is deprecated or changes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

List some common system call APIs

A

POSIX for Unix, Linux, Mac OS X
Win32 for Windows
Java APIs for JAVA VM

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a system call table?

A
A table of all system
calls, indexed by a
unique number
associated with each
system call.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What system call can you use to trace system calls?

A

strace

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do you get more information about system calls?

A

man pages

e.g., man strace

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a process?

A

A program in execution

A container of information needed by an OS to run a program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a process tree?

A

The idea that processes can create new child processes and so in in a tree like way (Only one parent)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are Pipes?

A

A mechanism for letting two processes communicate with eachother.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does IPC stand for?

A

Inter-process communication

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are sockets used for?

A

Networking

17
Q

What are devices - from a UNIX file API perspective?

A

Under UNIX, every piece of hardware is a file. Device files allow access to hardware.

18
Q

What are block devices?

A

Devices which are read from in discrete units (e.g., 1024 units at a time)

19
Q

What are character devices?

A

Devices, where a specific piece of data can only be written/read once (e.g., mouse click)