os hw final review

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/78

flashcard set

Earn XP

Description and Tags

hw 5-10

Last updated 8:12 PM on 4/24/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

79 Terms

1
New cards

Which style of monitor directly transfers the control from the thread invoking signal() to the waken thread? 

A. Hoare Style

B. Mesa Style

A. Hoare Style

2
New cards

If wait(&lock) is invoked after signal(&lock) is invoked, the wait call will...

A. wait

B. continue

A. wait

3
New cards

Do we always have a deadlock if all four deadlock conditions are met?

Yes or No

No

4
New cards

When starting a program, what happens after each step to switch from the kernel evel to the user level?

create a process and initialize the address space

load the program into the memory

5
New cards

When starting a program, what happens after each step to switch from the kernel evel to the user level?

set the HW pointer to the translation table

set the CPU to user mode

6
New cards

When starting a program, what happens after each step to switch from the kernel evel to the user level?
set the CPU to user mode

jump to the entry point of the program

7
New cards

When starting a program, what happens after each step to switch from the kernel evel to the user level?

load the program into the memory

initialize the translation table

8
New cards

When starting a program, what happens after each step to switch from the kernel evel to the user level?

initialize translation table

set the HW pointer to the translation table

9
New cards

Suppose you have a 16-bit machine with a page size of 16B. Assume that any unsigned integer can be a potential memory address. Also, assume that the machine can support up to only 32KB of physical memory. (1K =2 10)

For paging-based memory allocation, how many page table entries (in decimals) do you need to map the virtual address space of a process, with pure paging alone?

4096

10
New cards

Suppose you have a 16-bit machine with a page size of 16B. Assume that any unsigned integer can be a potential memory address. Also, assume that the machine can support up to only 32KB of physical memory. (1K =210).

Translate the virtual address 0x0000 to its physical address (base 16) via the segmented-paging scheme.   Assume that a program has two segments and a page size of 16B.  

segment number

page table base

page table bound

0

0x8000

0x8

1

0x0000

0x8

physical memory address 0x0000

virtual page number

physical page number

0x000

0x500

0x001

0x504

0x002

0x508

0x003

0x50B

...

physical memory address 0x8000

virtual page number

physical page number

0x000

0x100

0x001

0x104

0x002

0x108

0x003

0x10B

...

Please leave out '0x' in your answer.

1000

11
New cards

Suppose you have a 16-bit machine with a page size of 16B. Assume that any unsigned integer can be a potential memory address. Also, assume that the machine can support up to only 32KB of physical memory. (1K = 210)

Translate the virtual address 0x0003 to its physical address (base 16) via the segmented-paging scheme.   Assume that a program has two segments and a page size of 16B.  

segment number

page table base

page table bound

0

0x8000

0x8

1

0x0000

0x8

physical memory address 0x0000

virtual page number

physical page number

0x000

0x500

0x001

0x504

0x002

0x508

0x003

0x50B

...

physical memory address 0x8000

virtual page number

physical page number

0x000

0x100

0x001

0x104

0x002

0x108

0x003

0x10B

...

Please leave out '0x' in your answer

1003

12
New cards

Suppose you have a 16-bit machine with a page size of 16B. Assume that any unsigned integer can be a potential memory address. Also, assume that the machine can support up to only 32KB of physical memory. (1K = 210)

Translate the virtual address 0x8020 to its physical address (base 16) via the segmented-paging scheme.   Assume that a program has two segments and a page size of 16B.  

segment number

page table base

page table bound

0

0x8000

0x8

1

0x0000

0x8

physical memory address 0x0000

virtual page number

physical page number

0x000

0x500

0x001

0x504

0x002

0x508

0x003

0x50B

...

physical memory address 0x8000

virtual page number

physical page number

0x000

0x100

0x001

0x104

0x002

0x108

0x003

0x10B

...

Please leave out '0x' in your answer.

5080

13
New cards

caching

Storing copies of data at places that can be accessed more quickly

14
New cards

temporal locality

Recently referenced locations are more likely to be referenced soon

15
New cards

spatial locality

Reference locations tend to be clustered

16
New cards

cache pollution

Leaving behind cache content with no localities

17
New cards

compulsory misses

Data brought into the cache for the first time

18
New cards

capacity misses

Caused by the limited size of a cache

19
New cards

write-through caching policy

Immediately propagates update through various level of caching

20
New cards

write-back caching policy

Delaying the propagation until the cached item is replaced

21
New cards

What is the effective access time of memory (in decimals) through L1 and L2 caches for the following hardware characteristics?

access time

cache hit rate

L1 cache

1 clock cycle

75% or 3/4

L2 cache

3 clock cycle

75% of 3/4

memory

4 clock cycle

100% or 1

2

22
New cards

demand paging

Allowing pages that are referenced actively to be loaded into memory

23
New cards

page fault

A referenced page is not in memory

24
New cards

Belady's anomaly

Adding more memory results in more page faults

25
New cards

thrashing

When the memory is overcommitted

26
New cards

For the following reference stream, what is the content of page 2 at the end of the reference stream under MIN?

E

A

R

N

R

E

A

R

N

E

A

R

1

2

3

E

27
New cards

For the following reference stream, what is the content of page 2 at the end of the reference stream under LRU?

E

A

R

N

R

E

A

R

N

E

A

R

1

2

3

R

28
New cards

For the following reference stream, what is the content of page 2 at the end of the reference stream under LFU?

E

A

R

N

R

E

A

R

N

E

A

R

1

2

3

A

29
New cards

device controller

Converting between serial bit stream and a block of bytes

30
New cards

device driver

An OS component that hides the complexity of an I/O device

31
New cards

memory-mapped I/O

Making no distinction between device addresses and memory addreesses

32
New cards

polling

A CPU repeatedly checks the status of a device

33
New cards

interrupt-driven I/Os

A device controller notifies the corresponding driver when the device is available

34
New cards

direct memory access

Using an additional controller to perform data movements

35
New cards

A keyboard is an example of ...

character device

36
New cards

A disk is an example of ...

block device

37
New cards

At a given moment, the disk head is at cylinder 46, and the queue contains cylinder requests: 10, 45, 52, 56, 70.

If the driver uses the FIFO, which request will be serviced last?

A. 10

B. 45

C. 52

D. 56

E. 70

E. 70

38
New cards

At a given moment, the disk head is at cylinder 46, and the queue contains cylinder requests: 10, 45, 52, 56, 70.

If the driver uses the SSTF, which request will be serviced last?

A. 10

B. 45

C. 52

D. 56

E. 70

A. 10

39
New cards

At a given moment, the disk head is at cylinder 46, and the queue contains cylinder requests: 10, 45, 52, 56, 70.

If the driver uses the SCAN, which request will be serviced last?  If there are multiple answers, pick the answer with the lowest block number.

A. 10

B. 45

C. 52

D. 56

E. 70

A. 10

40
New cards

Which disk allocation policy is least reliable?

A. linked-list allocation 

B. continuous allocation

C. index-based allocation

D. multi-level indexing 

A. linked-list allocation 

41
New cards

Which disk allocation policies offer efficient random accesses?  (check all answers that apply)

linked-list allocation 

continuous allocation

index-based allocation

multi-level indexing 

continuous allocation

index-based allocation

multi-level indexing 

42
New cards

Most files are…

large or small

small

43
New cards

Which namespace is most prone to name collisions?

A. flat name space 

B. hierarchical name space 

C. relational naming 

D. contextual naming 

A. flat name space 

44
New cards

Free blocks, directories, file headers, indirect blocks are an example of...

metadata

45
New cards

fsck

Ad hoc file system check

46
New cards

atomicity

All operations either happen or they do not

47
New cards

serializability

Transactions appear to happen one after another

48
New cards

durability

Once a transaction happens, it is recoverable and can survive crashes

49
New cards

Write a program create_files in any language to create a file foo, sleep for 5 seconds, and create a file bar. 

Right after you start the program, press Ctrl-C to prevent the program from completing.  What do you see in the directory?  

foo

bar

journal

nothing

foo

50
New cards

Write programs atomically_create_files and replay_journal so that files foo and bar are atomically created   First, atomically_create_files logs <begin transaction> into the journal file journal.  Second, atomically_create_files logs <create foo> and <create bar> into journal.  Third, atomically_create_files logs <commit> into journal.  A second replay_journal program can read the journal file to perform the actual file creations and delete journal.  If there is a crash before <commit> is written into journal, replay_journal just deletes journal.  If there is a crash before replay_journal can complete the creation of the two files, replay_journal can be run again to recreate both files.  Finally, after both files are created, replay_journal removes journal.

You can inject crashes by exiting at various points in various programs.  First, copy the program atomically_create_files to atomically_create_files_crash.  Insert a crash point between the logging of two file creation operations in atomically_create_file_crash.  

Run atomically_create_files_crash and run replay_journal.  What do you see in the directory at this point?

foo

bar

journal

nothing

nothing

51
New cards

Write programs atomically_create_files and replay_journal so that files foo and bar are atomically created   First, atomically_create_files logs <begin transaction> into the journal file journal.  Second, atomically_create_files logs <create foo> and <create bar> into journal.  Third, atomically_create_files logs <commit> into journal.  A second replay_journal program can read the journal file to perform the actual file creations and delete journal.  If there is a crash before <commit> is written into journal, replay_journal just deletes journal.  If there is a crash before replay_journal can complete the creation of the two files, replay_journal can be run again to recreate both files.  Finally, after both files are created, replay_journal removes journal.

You can inject crashes by exiting at various points in various programs.  First, copy the program replay_journal to replay_journal_crash.  Insert a crash point after recreating the first file in replay_journal_crash.  

Run atomically_create_files, run replay_journal_crash, and run replay_journal.  What do you see in the directory at this point? 

foo

bar

journal

nothing

foo, bar

52
New cards

Security is a form of...

policy or mechanism

policy

53
New cards

Which of the keys are used to encrypt (not decrypt) a message when anyone can create the message, but only A can read the message? Please check all answers that apply.

public key of A

private key of A

public key of A

54
New cards

confidentiality

Secret data remains secret

55
New cards

integrity

Unauthorized user should not be able to modify data

56
New cards

availability

Nobody can make a system unusable

57
New cards

authentication

Determining who the user is

58
New cards

authorization

Determining who is allowed to do what

59
New cards

enforcement

Making sure people can do only what they are allowed to do

60
New cards

access control list

Storing all permissions for all users with each object

61
New cards

capability list

Storing all objects a process can touch

62
New cards

Trojan horse

Seemingly innocent program that performs an unexpected function

63
New cards

What are some characteristics of IP transmissions?   Check all answers that apply.

machine-to-machine 

ordered

reliable

user-to-user

machine-to-machine 

64
New cards

What are some characteristics of UDP transmissions?   Check all answers that apply.

user-to-user 

machine-to-machine 

ordered 

reliable 

user-to-user 

65
New cards

What are some characteristics of TCP transmissions?  Check all answers that apply.

ordered

reliable

user-to-user

machine-to-machine 

ordered

reliable

user-to-user

66
New cards

Which networks have no arbitration?

point-to-point or broadcast

point-to-point

67
New cards

distributed systems

Allowing physically separate computers to work together

68
New cards

network

Physical connection that allows two computers to communicate

69
New cards

packet

A unit of transfer

70
New cards

protocol

An agreement between two parties as how information is to be transmitted

71
New cards

arbitration

Concerning the way to share a given resource

72
New cards

carrier sensing

Ethernet does not send unless the network is idle

73
New cards

routing

Concerning how a packet can reach its destination

74
New cards

Location transparency means the location of the execution is visible to the user.
true or false

false

75
New cards

Which write consistency model does NFS use?

A. write through

B. write back

C. other

A. write through

76
New cards

Which write consistency model does AFS use?

A. write through

B. write back

C. other

B. write back

77
New cards

Which write consistency model does xFS use?

A. write through

B. write back

C. other

C. other

78
New cards

Which of the keys are used to encrypt (not decrypt) a message when anyone can create the message, but only A can read the message?  Please check all answers that apply.

A. public key of A

B. private key of A

A. public key of A

79
New cards

Write programs atomically_create_files and replay_journal so that files foo and bar are atomically created   First, atomically_create_files logs <begin transaction> into the journal file journal.  Second, atomically_create_files logs <create foo> and <create bar> into journal.  Third, atomically_create_files logs <commit> into journal.  A second replay_journal program can read the journal file to perform the actual file creations and delete journal.  If there is a crash before <commit> is written into journal, replay_journal just deletes journal.  If there is a crash before replay_journal can complete the creation of the two files, replay_journal can be run again to recreate both files.  Finally, after both files are created, replay_journal removes journal.

You can inject crashes by exiting at various points in various programs.  First, copy the program atomically_create_files to atomically_create_files_crash.  Insert a crash point between the logging of two file creation operations in atomically_create_file_crash.  

Run atomically_create_files_crash and run replay_journal.  What do you see in the directory at this point?

journal

foo

bar

nothing

nothing