System calls and OS structure Flashcards

1
Q

What are the two main functions of an operating system?

A
  • Providing abstractions to user programs.
  • Managing the computer’s resources.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does the interface between user programs and the operating system primarily deal with?

A

Dealing with abstractions such as file creation, writing, reading, and deletion.

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

What is the purpose of system calls in the operating system?

A

System calls allow user programs to request services from the operating system, such as reading data from a file.

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

How are system calls invoked from C programs?

A

System calls are typically invoked by calling library procedures with the same name as the system call.

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

What happens when a process makes a system call?

A

The process executes a trap instruction to transfer control to the operating system, which carries out the system call and returns control to the instruction following the system call.

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

How does the operating system determine the requested service in a system call?

A

The operating system inspects the parameters passed by the calling process to determine the specific system call and its required actions.

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

What is the purpose of the TRAP instruction in the system-call mechanism?

A

The TRAP instruction switches the processor from user mode to kernel mode and starts execution at a fixed address within the kernel.

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

How are system calls handled by the operating system?

A

The system-call handler, determined by the system-call number, is invoked to perform the requested service.

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

What happens if a system call encounters an error or invalid parameter?

A

The system call sets the return value to -1 and stores the error number in a global variable called errno.

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

How does the fork system call work in the process management of an operating system?

A

The fork system call creates an exact duplicate of the original process, including all its resources, and returns the process ID (PID) of the child to the parent.

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

What are the three system calls related to directory managemente?

A

mkdir
rmdir
link

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

What is the purpose of the mkdir system call?

A

The mkdir system call is used to create a new empty directory.

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

How does the link system call work?

A

The link system call allows the same file to appear under two or more names in different directories.

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

How does the rmdir system call function?

A

The rmdir system call is used to remove an empty directory from the file system.

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

What happens when a file is linked using the link system call?

A

When a file is linked, changes made to the file by any user are instantly visible to other users who have access to the file. It creates multiple directory entries that refer to the same file.

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

What happens if one of the linked directory entries is removed using the unlink system call?

A

If one of the linked directory entries is removed using the unlink system call, the other linked entry remains unaffected.

17
Q

How does the mount system call work in UNIX?

A

The mount system call allows two file systems to be merged into one.

18
Q

What is the purpose of the chdir system call?

A

is used to change the current working directory of a process.

19
Q

What does the chmod system call do?

A

changing the mode of a file, which includes modifying the read-write-execute permissions for the owner, group, and others.

20
Q

What is a monolithic operating system structure?

A

In a monolithic system, the entire operating system runs as a single program in kernel mode. It is written as a collection of procedures linked together into a large executable binary program.

21
Q

What are the advantages and disadvantages of a monolithic system?

A

+ efficient as procedures can call any other procedure directly

+ simple and straightforward design

  • can become unwieldy and difficult to understand due to the unrestricted interaction between procedures.
  • a crash in any procedure can cause the entire OS to crash.
22
Q

Describe the layered system structure.

A

A layered system organizes the OS as a hierarchy of layers, where each layer is built upon the one below it. Each layer provides a specific functionality, and higher layers utilize services provided by lower layers.

23
Q

What was the purpose of the THE system’s layered approach?

A

used layers to provide abstraction and isolation between different aspects of the system

24
Q

How does the microkernel structure differ from the monolithic structure?

A

the OS is split into small, well-defined modules.

only runs in kernel mode while other components run as user processes.

25
Q

What are some advantages of using a microkernel?

A

better reliability as bugs in user processes are less likely to crash the system

flexibility by allowing dynamic loading and unloading of components

26
Q

How does the client-server model differ from the microkernel structure?

A

OS distinguishes between client processes and server processes. clients request services from servers by sending messages, and servers provide those services