eksamensprepp Flashcards

(30 cards)

1
Q

what is inside code - memory

A

OS instantiates code, and other static data

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

what are in the stack

A

used for function calls, local variables

Fast, structured (LIFO)

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

what are in the heap

A

dynamic memory (e.g., malloc, new)

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

page and page frame size

A

page - fixed size block in virtual memory
page frame - fixed size block physical memory

same size (4KB)

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

what does condition variable do

A

producer to wait until there is space
consumer to wait until there is an item in the buffer

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

producer consumer problem - what is the goal

A

We need to ensure that when a producer is placing an item in the buffer, then at the same time consumer should not consume any item

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

what is the critical section i producer-consumer problem

A

the buffer

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

solve producer consumer problem

A

needs 2 semaphores - 1 full 1 empty

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

semaphore value = 0 -> then calls wait -> what happens

A

nothing, cant call wait, bc the thread sleeps

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

difference between SSD and HDD

A

SSD shorter life span - bc limited write cycles

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

must all queues in MLFQ use the same scheduling algorithm

A

no

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

method to fix external fragmentation

A

compact - small blocks into one big

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

internal vs external fragmentation

A

Internal fragmentation = unused space inside an allocated block(pages)

External fragmentation = unused space between allocated blocks (heap, stack)

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

what is not shared among threads

A

stack registers of threads

each thread has its own stack

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

fork - hva returnerer den

A

returnere to forskjellige prossesser

parent - 0 >
child - returner 0

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

solution for critical section

A

mutual exlusion, bounded waiting, progress

16
Q

what does progress mean in ensuring critical section is safe

A

thread want to enter the critical section, and no one is inside
→ then some process must be allowed to proceed

17
Q

what is bounded waiting

A

here must be a limit (bound) on how many times other processes can enter their critical sections before a waiting process gets its turn

18
Q

hvor mange bytes er 1GB

19
Q

where in RAM you should put a process

A

free list - alogirthm

19
Q

waiting time

A

waiting = turnaroud - execution time

20
Q

how to allocate countigous PHYSICAL memory to a process

A

fixed parition, variable partition

21
Q

fixed partition

A

physical memory is divided into a fixed number of partitions before runtime

if smaller than fixed size - internal fragmentation

22
Q

variable partition

A

It allocates exactly the amount of memory needed - finds a hole big enough for it

23
hybrid lock
spin lock - spins and call yield to give up the CPU combines spin + yield
24
allocate space in virtual memory
segmentation paging
25
interrupts
26
averege memory access time
AMAT = miss rate * Pmiss + hit rate * Phit
27
what is the producer -consumer problem
when the shared count variable have different values, bc count is not atomic and can be interrupted mid count (load, increment, store - 3 operations inside count)
28
CFS