Lecture 15+16 Flashcards

1
Q

How does modularity factor into operating systems?

A

Need modularity to aid in careful design, this is largely present in the distinction between system programs and application programs.

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

What is the difference between a system program and application program? What is the user inteface?

A

Application program is one ordinary users interact with A system program is one that provides low level functions, typically more for programmers to utilise. The user interface is defined by the set of system programs.

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

What are system calls? What is the programmer interface?

A

The programmer interface is the set of system calls available. These system calls allow programs to issue requests to the kernel.

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

How are system calls implemented?

A

The CPU responds to interrupts, these transfer control to appropriate handler in kernel. System calls generate these interrupts, (known as traps or soft interrupts).

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

How are interrupts implemented in the CPU?

A

Piece of hardware known as interrupt request line, check this at end of each cycle. If signal is there respond.
This is done by 1.saving state of current process(context),
2. Transfer control to a fixed memory location holding appropriate interrupt-handling routine.
3. When routine is finished, restore state of interrupted process.

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

What is the interrupt vector?

A

Array of locations, holds address of interrupt-handling routines.

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

What are the components of a process?

A

text/code section: program code itself.
Data section: any global variables used by program
Process stack: Any local variables currently being used.
Program counter: A pointer to some place in the program code.
Contents of CPU registers.
Memory management information.
Device/file allocation information
and accounting information

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

What are the states a process can be in?

A

New, running, waiting, ready, terminated.

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

What is a process control block?

A

This is used to keep a record of each process in the system.

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

What are the types of schedulers and scheduling queues?

A

Long-term scheduler: Decides which processes on disk should be moved to main memory.
Short-term scheduler: How to allocate the CPU amongst processors ready to execute.
Job queue: used in large data centers for scheduling applications in user space.
Ready queue
Device queue: all processes waiting to use a device(one for each device). Queues are generally represented as linked lists.

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

How are processes created?

A

By another process, a process can create a copy using fork() and the child process can call exec() to load a new program.

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

How are users represented to the operating system?

A

As processes, the most important of which is root.

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

What is a cooperating process? Why might we want this?

A

Cooperating processes is when the execution of one process can affect execution of another.
Independent processes: This is when the execution of one process cannot affect the execution of another.
Cooperating allows us to: share information, speedup computation via parallelism and to introduce modularity.

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

How are child processes in linux?

A

Use the fork system call(copying the paren’t address space), this returns a 0 if the process is the child or the process ID of the child if not. The child process can then execute execlp command to load a new program into its memory space.

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

What does the wait system call do?

A

Moves a process off the ready queue until the child process has terminated.

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

How do we terminate processes? What are some special processes that can come about?

A

Processes execute the exit system call once they execute their last statement. They can also be terminated with kill if you made that process. An orphan process is a process whose parent dies, these are inherited by init and killed.
A zombie process is one which terminated, but its live parent process isn’t waiting, making it stay in process table.

17
Q

What does mmap system call do?

A

Allow two or more processes to share some memory space.

18
Q

What is a thread? What does it allow?

A

Threads are a special kind of process, they just have a program counter, register set and stack space. They allow for complex data sharing as several threads can run the same process.

19
Q

What is a task? How does this relate to heavyweight/lightweight?

A

A task is the code section, data section, and O/S housekeeping info is collectively known as a task.
A task with just one thread is heavyweight, a thread is a lightweight process.

20
Q

What are the two-kinds of the threads?

A

User-level threads: implemented via user-level libraries, no need for system calls. These are fast to switch between but kernel doesn’t know individual threads for a process. This is bad for fairness and system calls.
Kernel-level threads are implemented via system calls, slower, but kernel knows.

21
Q

What are the pros/cons of threads?

A

Pros: responsive, resource sharing, economy, and scalability. Problems: use level threads don’t get fair shair of CPU. Kernel threads similar to processes. Sharing can cause data race problems.

22
Q

What are signals?

A

Communication channels between OS kernel and processes and between processes. Requires signal handler, otherwise default action is to kill/terminate. Common signals are ignore, core, stop and continue.