Chapter 2 Flashcards

(27 cards)

1
Q

How is a system call implemented in an OS?

A

Using a system call index table. Each system call has a unique number (index) used by the kernel to locate the appropriate handler function.

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

What is a system call index table?

A

A system call index table is a special table that the operating system (OS) keeps, where each entry represents a system call.

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

What are the three main parameter passing methods for system calls?

A

1) Registers, 2) Memory block or table, 3) Stack.

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

What is the advantage of passing system call parameters via registers?

A

Fast and efficient, but limited by the number of available registers.

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

What is the advantage of passing system call parameters via memory blocks?

A

Flexible, supports larger parameter sets. Only the starting address needs to be passed.

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

Why is stack-based parameter passing often used for system calls?

A

It is flexible, does not require a fixed number of parameters, and is portable across different architectures.

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

What are the two main models of interprocess communication (IPC)?

A

Message passing and shared memory.

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

What is message passing in IPC?

A

Processes exchange data by sending and receiving messages through the operating system.

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

What is an advantage of message passing?

A

Simplicity and synchronization is built-in; processes do not directly share memory space.

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

What is shared memory in IPC?

A

Multiple processes share a region of memory. Processes can read and write directly to the shared space.

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

What is the main advantage of shared memory IPC?

A

High performance because processes can directly access data without kernel involvement after setup.

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

What is the challenge of shared memory IPC?

A

Requires careful synchronization (e.g., semaphores, mutexes) to avoid race conditions.

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

Why is there no perfect operating system?

A

Different systems have conflicting requirements (e.g., performance vs. security, simplicity vs. functionality). Trade-offs are always necessary.

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

Give an example of conflicting OS requirements.

A

High security may reduce performance; high performance may reduce portability or flexibility.

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

What is the difference between policy and mechanism in OS design?

A

Mechanism = how something is done (implementation). Policy = what decision to make (strategy).

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

Give an analogy for policy vs. mechanism.

A

Mechanism = function definition (fixed code). Policy = parameters passed to the function (easily changed).

17
Q

Why separate policy and mechanism?

A

It increases flexibility; OS mechanisms can be reused with different policies.

18
Q

What type of structure does MS-DOS use?

A

A simple, single-tasking structure with no separation between user and kernel mode.

19
Q

What are limitations of the MS-DOS structure?

A

No memory protection, poor stability, and limited multitasking.

20
Q

What type of structure does UNIX use?

A

A layered but monolithic structure. Kernel provides file system, process management, device drivers.

21
Q

What are features of the UNIX OS structure?

A

Better separation, multiuser support, multitasking, but still monolithic (kernel is one large program).

22
Q

What type of structure does Windows use?

A

A hybrid structure combining aspects of monolithic and microkernel designs.

23
Q

What are features of Windows OS structure?

A

Modular, supports multitasking, GUI, kernel-mode and user-mode separation, better portability.

24
Q

What is a command interpreter (shell)?

A

A program that reads user commands and translates them into OS actions.

25
Give examples of command interpreters.
UNIX shell (bash, sh), Windows CMD, PowerShell.
26
How do you compile and run a C program from the command line?
Example: gcc prog.c -o prog → ./prog
27
What are argc and argv in C programs?
argc = number of arguments. argv = array of strings (command-line arguments).