CPU-intro Flashcards

1
Q

By running one process, then stopping it running another, the OS promote the illusion that many virtual CPUs exist when in fact there is only one physical CPU (or a few). This technique is also called.

A

Time sharing of the CPU

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

What does time sharing allow users to do?

A

Run many concurrent processes

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

Negatives with time sharing of CPU

A

Performance cost, as each will run more slowly if the CPU(s) must be shared.

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

Low-level machinery of the OS is called

A

Mechanisms

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

Explain mechanisms

A

Are low-level methods or protocols that implement a needed piece of functionality. Mechanisms are the implementations that enforce policies, and often depend to some extent on the hardware on which the operating system runs.

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

Name an example of low-level machinery

A

Context switch, it is a time-sharing mechanism employed by the OS

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

What ability does the context switch give the OS?

A

Ability to stop running one program and starting running another on a given CPU

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

Explain what policies are

A

Policies are algorithms for making some kind of decision within the OS.

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

Give an example of a policy within the OS

A

Scheduling policy (deciding which processes should run)

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

The abstraction provided by the OS of a running program.

A

Process

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

What a program can read or update when it is running

A

Its machine state

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

Name components of machine state that comprises a process

A

Memory, registers, storage device

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

The memory that the process can address

A

Address space

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

What are the process registers?

A

Many instructions explicitly read or update registers, important to the execution of the process.

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

Give an example of the processes registers

A

Program counter (PC)

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

What is the program counter

A

It tells us which instruction of the program that is currently being executed.

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

Explain stack pointer and fram pointer

A

Are used to manage the stack for function parameters, local variables, and return addresses.

18
Q

Name some of the API that must be included of an operating system.

A

Create, destroy, wait, miscellaneous control, status

19
Q

Explan the method create

A

An operating system must include some method to create new processes.

20
Q

Explain the method destroy

A

A way to destroy proesses forcefully.

21
Q

Explain the method wait

A

Wait for a process to stop running.

22
Q

Explain miscellaneous control

A

For example can be a method to suspend a process, and then resume it.

23
Q

Explain status

A

Interfaces to get some status information about a process as well, how long it has run for or its state.

24
Q

How does the OS get a program up and running?

A

OS load its code and any static data (initilized variable) into memory, into the address space of the process. Programs reside on disk in some kind of executable format. The OS reads those bytes from disk and place them in memory.

25
Q

What does it mean when an operating system loads the process eagery

A

All at once before running the program.

26
Q

Loads the process lazily

A

Loads pieces of code or data only as they are needed during program execution.

27
Q

Explain what the stack is

A

Contains the programs local variables, function parameters and return addresses. OS will ikely initilized the stack with arguments (fill the parameters to main function, ie arg and argv).

28
Q

Explain heap

A

Heap is used for explicitly requested dynamically-allocated data.

29
Q

Which methods does programs have to request and release space on the heap?

A

malloc() and free().

30
Q

Which file descriptors does each process by efault have?

A

Standard input, output and error.

31
Q

How does the OS transfers control to the CPU to the newly-created process?

A

Jumping to the main() routine. And the program begins its execution.

32
Q

Explain the three states a process can be in

A

Running: A process is running on a process, it is executing instructions.
Ready: Process is ready to run but is OS has chosen not to run it at this given moment.
Blocked: A process has performed some kind of operation that makes it not ready to run until some other event takes place (process init an I/O request).

33
Q

Process being moved from ready to running

A

Process has been scheduled.

34
Q

Process being moved from running to ready

A

Descheduled

35
Q

When does a blocked process (through I/O init) becomes ready?

A

I/O completion.

36
Q

Explain process list

A

A list for all processes that are ready, as well as some additional information to track which process is currently running. It is a datastructure of the OS.

37
Q

What is a register context?

A

It holds for a stopped process, the contents of its registers.

38
Q

What is a zombie state?

A

A process has exited but has not been cleaned up.

39
Q

What happens when a parent waits for its child?

A

Wait for the completion of child, also indicate to the OS that is can clean up any relevant data structures that referred to the now-extinct process.

40
Q

Why do we seperate the OS mechanisms from the policies?

A

Allows to change policies without having to rethink the mechanism and form a modularity (general software design principle).

41
Q

What is another name of the individual structure that stores information about a process?

A

Process Control Block (PCB).