Operating Systems Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Interface

A

Describes what a computer program does and how it interacts with the rest of programs

There is nothing more fundamental in computer science than Interfaces.

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

Abstraction

A

An interface to application programmers that separates policy—what the interface commits to accomplishing—​from mechanism—how the interface is implemented.

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

Who is responsible for intra-process communication?

A

The software developer (You)

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

Who is responsible for inter-process communication?

A

The Operating System

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

Are Thread stacks tipically private (can only be seen by the owner Thread) or public (can be seen by all Threads in a process?

A

Private

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

Mechanisms of Thread intra-process communication

A

Shared memory
Share open file handles
Static and dynamically-allocated global variables

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

Mechanisms of Thread inter-process communication

A
Shared files 
Sockets
Exit codes
Signals
Pipes
Shared memory
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Can a Thread from one Process contact a Thread from another Process to request/send resources?

A

Only with mutual consent from both Processes, meaning a mechanism for the communication to happen (i.e. sockets, shared files…) was previously set .

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

The only thing that can ‘run’ on a system

A

Thread

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

When is a Process considered running?

A

When at least one of its Threads is running

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

Who are the primary users of the kernel?

A

Processes

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

What do processes contain?

A

One or more threads
An address space
Zero or more open file handles representing files.

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

Who populates /proc entries?

A

The kernel. It uses /proc to export infomation

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

Pseudo filesystem similar to /proc that can modify system behaviour while running

A

/sys

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

Who protects Processes from each other??

A

The OS

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

File Descriptor

A

An int index returned by open() that points to a position in the File Table array

17
Q

File Handle

A

Contains FIle Mode and offset (position in File where the next read or write is going to be done).

18
Q

File Object

A

Hold file state, other than the state held by File Handle.

19
Q

How is a new process created?

A

By calling fork() (or clone() a more flexible primitive)

20
Q

Used to abstract and multiplex the CPU

A

Threads

21
Q

The fastest part of your computer system

A

The CPU (cache memory is a lot faster than main memory)

22
Q

Why is a ‘race condition’ bad for program behaviour?

A

Races can be won by any of its competitors. In this case is Threads. We don’t want the outcome of a program to change depending on which Thread, or instructions within the Thread, ‘wins the race’

23
Q

Atomicity

A

An atomic transaction is an indivisible and irreducible series of database operations such that either all occurs, or nothing occurs.

24
Q

2 most important things about concurrency programming

A
  • Coordination

- Correctness

25
Q

Critical Section - Requirements

A

Mutual Exclusion: this is the most basic property. Only one thread should be executing in the critical section at one time.

Progress: all threads should eventually be able to proceed through the critical section.

Performance: we want to keep critical sections as small as possible without sacrificing correctness.

26
Q

Critical Section

A

A set of instructions that must have atomic behaviour with respect to other threads executing (other Threads can’t observe intermediate values), typically to access a shared resource

27
Q

Command to read ELF files

A

readelf

28
Q

exec() steps, including argument passing

A
  • Arguments saved by the kernel
  • Address space wiped out (often saved to be swaped-in in case of exec failure)
  • The wanted program file is located and loaded into the Address Space
  • Arguments are retrieved by the kernel and loaded into the stack
  • Process starts running, arguments can be used by the main function (argc argv)
29
Q

New Process creation process

A
  • The parent process creates a pipe object by calling pipe(). The File Table now has File Descriptors for both the reading and writing ends of the pipe.
  • The parent Process calls fork(), making an exact copy of itself, the child.
  • The parent closes its copy of the read end and the child closes its copy of the write end.
  • The child tipically calls exec() to load a new program file.
30
Q

Full process for a new program to run (short steps)

A
  • pipe(): A pipe is created
  • fork(): The calling Process is copied, File Descriptors shared between parent and child
  • Close pipe ends: parent/read, child/write
  • exec(): Child Address Space is wiped. The wanted program is located and loaded into the Address Space
31
Q

What gets copied into the child Process when fork() is called?

A
  • The calling Thread
  • The contents of the Address Space
  • The File Descriptors