cs4310 midterm questions

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

1/45

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 3:14 AM on 3/18/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

46 Terms

1
New cards

What are the two viewpoints/perspectives that operating systems can be viewed?

Bottom-up view OS as resource manager. Top-down OS serves as abstraction layer over hardware. Look at interfaces that serve hardware

2
New cards

To use cache memory, main memory is divided into cache lines, typically 32 or 64 bytes long. An entire cache line is cached at once. What is the advantages of caching an entire line instead of a single byte or word at a time?

It takes more time to load to a cache. Data declared together is often accessed together so loading the entire block into cache reduces future memory access

3
New cards

On early computers, every byte of data read or written was handled by the CPU (no DMA Direct Memory Access) What implications does this have for multiprogramming?

Some registers will override and change information, thus they need to coordinate what registers are being used. In addition, CPU handles all I/O transfers wasting CPU time and reducing efficiency of multiprogramming since fewer CPU cycles are available for running other programs

4
New cards

There are several design goals in building an OS. What are two design goals that may contradict one another?

Security contradicts convenience because extra security may take longer to do tasks

5
New cards

On all current computers, at least part of interrupt handlers are written in assembly. Why?

Because memory is finite and low level programs need to be done fast when switching between programs. Requires precise low level control of hardware and CPU registers during interrupts

6
New cards

To a programmer, a system call looks like any other call to a library procedure. Is it important that a programmer knows which library procedures result in syscalls? Under what circumstances and why?

Yes because User inputs should be sanitized if used and error handling should be done. In addition performance matters since switching between user space and kernel space is expensive. Important under performance critical systems or security systems since working with the kernel.

7
New cards

Instructions related to accessing I/O devices are typically privileged instructions (executed in kernel mode only) why?

Kernel is the one that actually deals with devices making it simpler. Restricting to kernel mode prevents user programs from directly accessing devices and interfering with the system

8
New cards

Why have a kind of process (threads) within a process?

In many applications multiple activities are happening at once and threads are lighter weight than processes. Substantial computing and I/O allow activities to overlap improving performance. Useful in true hardware parallelism environments

9
New cards

Drawbacks of User Space Threads?

Invisible to kernel and lack of coordination

10
New cards

Why are kernel threads slower to create and manage?

Switching between OS and Kernel

11
New cards

Why should scheduler make efficient use of the CPU?

Because process switching is very expensive

12
New cards

What happens if one process has many children running under its control?

Separate scheduling mechanism from scheduling policy. Scheduling algorithm is parameterized in some way, but the parameters can be filled by user process

13
New cards

When an interrupt or a syscall transfers control from the process to the OS, a kernel stack area separate from the stack of the interrupted process is used. Why?

Integrity, make sure current state is correct. Security since we want to prevent vulnerabilities by validating the stack. This should be done while OS handles the interrupt or syscall.

14
New cards

Why would a thread ever voluntarily give up the CPU by calling thread_yield? After all since there is not periodic clock interrupt, it may never get the CPU back

If a different thread has higher priority and because of synchronization

15
New cards

What happens when you fork?

Program is copied at exact time of execution

16
New cards

How many child processes are created upon execution of the program: void main() { fork(); fork(); exit();}

3 children

<p>3 children</p>
17
New cards

What is the biggest advantage of implementing threads in user space?

OS doesn’t have to support it, can manage your own threads, faster to create

18
New cards

What is the biggest disadvantage of implementing threads in user space?

Can’t do true parallelism since kernel doesn’t know

19
New cards

Consider a car as real time system, what events are hard, soft, periodic, and aperiodic

Hard: Airbag deployment during a crash

Soft: backup camera display

Periodic: Engine control checks

Aperiodic events: object detection

20
New cards

On a single CPU system, simplest solution is to have each process disable all interrupts just after entering its critical region and reenable them just before leaving so no clock interrupts can occur. What is the problem?

Can slow down entire system, another process might be as critical, or priority isn’t as high as thought

21
New cards

What are the problems with lock variables?

State of lock might’ve changed

22
New cards

Problems with monitors and semaphores?

Moving to a distributed system consisting of multiple CPUs, each with own private memory and over LAN, no access to a common memory

23
New cards

How does the time quantum value and context switching time affect each other in a round robin scheduling algorithm?

A shorter quantum means more time spend context switching. There is an inverse relationship between the two so we need to find a balance

24
New cards

Consider a system in which it is desired to separate policy and mechanism for the scheduling of kernel threads. Propose a means of achieving this goal

Policy is handled in userland and mechanisms are handled in kernel space

25
New cards

Core problem with swapping?

Don’t know where memory places you and if you have specific jumps, it wouldn’t work with multiple programs

26
New cards

Why is static reallocation bad?

Memory can’t be changed while program is running

27
New cards

Why do radios, washing machines, and microwaves address absolute memory?

No user programs, time doesn’t matter since using nonvolatile memory, no need to use ram, usually only one program is run

28
New cards

Drawbacks of exposing physical memory to processes?

Easily trash the OS and difficult to have multiple programs running at once

29
New cards

What happens if the process is adjacent to another process and can’t grow into that process space?

Move up other process or swap out process to let it grow

30
New cards

What happens if the swap area on the disk/SSD is full?

Terminate a process depending on priority/implementation

31
New cards

What piece of hardware would keeping track of what slots are free in a set of resources be useful for?

Storage

32
New cards

In bitmaps, what is the design issue of allocation is too small or too large?

Too small bitmap too big, Too big parts of memory might be reserved even if not needed

33
New cards

Disadvantage of bitmaps?

Insertion into bitmaps take linear time plus additional searches to find what you need

34
New cards

Paging system issues

Mapping must be fast and page table should not be too large

35
New cards

What kind of hardware support is needed for a paged virtual memory to work?

Need MMU Memory Management Unit which is in CPU and TLB Translation Look Aside Buffer is a part of MMU.

36
New cards

What are two main problems when doing memory management purely off physical memory and with no data abstraction

Protection - Can overwrite past data and Isolation - might access other programs address

37
New cards

Difference between static relocation and dynamic reloocation

Static you add the base yourself while Dynamic CPU adds base value and limit value automatically

38
New cards

Why use next fit?

Improve allocation speed by continuing memory search from last allocation instead of starting from beginning. Reduces repeated scanning of same memory blocks and can make allocation faster

39
New cards

What happens if OS wants to change the bits in a page table entry?

Modify it in memory, but flush the corresponding TLB entry too

40
New cards

How is a page not referenced but modified?

Direct Memory Access (DMA) the device changes the page contents without CPU accessing so modified bit may be set while reference bit is not

41
New cards

The NRU (not recently used) algorithm removes a page at random from the lowest non empty class, why?

Higher classes are more likely to be used in the future

42
New cards

Issues with FIFO replacement algorithm?

Might remove something important

43
New cards

Issue with Least Recently Used replacement algorithm

Increases memory size and page size.

44
New cards

Scheduling can be handled if and only if

Compute/Period < 1

45
New cards

What are the four principal events that cause processes to be created?

System initialization (part of kernel), Execution of a process creation system call by a running process (Fork), a user request to create a new process (launching app on phone), initiation of a batch job (starting a script that starts a bunch of processes)

46
New cards

In page table entry, what bits are important?

Present/absent bit, protection bits, supervisor bit, modified bit, referenced bit, cached bit