Operating Systems Test 1

studied byStudied by 11 people
5.0(1)
Get a hint
Hint

One of the roles of an operating system is that of a "glue". From the list below please select all examples of an OS acting as "glue"

1 / 65

encourage image

There's no tags or description

Looks like no one added any tags here yet for you.

66 Terms

1

One of the roles of an operating system is that of a "glue". From the list below please select all examples of an OS acting as "glue"

-Files created by one application can be opened by another application
-Different apps have the same set of services, for example, the cope-paste function

New cards
2

One of the roles of an operating system is that of a "referee". From the list below please select all example of an OS acting as a "referee"

-Allocate resources for users and applications
-Provide an execution environment with common set of services

New cards
3

One of the roles of an OS is to act as an "illusionist". It makes your computer appear more

powerful

New cards
4

What memory regions do threads share within the same process?

data, instruction, heap. NOT stack, stack is divided among threads

New cards
5

T/F Threads are more expensive for the operating system kernel to create than processes

False

New cards
6

T/F An operating system should never create more processes than the available number of processors

False

New cards
7

T/F Linux is an example of a monolithic kernel

True

New cards
8

T/F The interrupt vector table should be held in kernel memory and not arbitrarily changed by users

True

New cards
9

T/F A command interpreter on the Linux system is also known as a shell

True

New cards
10

T/F fork() in Linux creates a child process, which then executes the function that is passed as an argument

False

New cards
11

T/F When you are programming with Posix pthreads there are several different exec() calls with different arguments

True

New cards
12

T/F Dana makes 8 calls to fork() in main. This is called a fork bomb.

False

New cards
13

T/F Threads created by a single process share the same memory address space

True

New cards
14

What piece of code goes on the line below?

check test

New cards
15

How many processes will be created in the code below?

main(){

fork()
fork()
fork()
fork()
fork()
print(hello world)

return 0
}

32, aka 2^5

New cards
16

What is the output of the following code segment below?

main(){
pid = fork()
if(pid == 0){
print statement 1
}else{
print statement 2
}
wait()
return 0
}

both statement 1 and statement 2 are printed

New cards
17

In the code segment below, what is printed on line 12?

check test

New cards
18

An operating system running in a virtual machine

guest OS

New cards
19

A kernel procedure invoked when an interrupt occurs

interrupt handler

New cards
20

Instruction available in kernel mode but not in user mode

privileged instruction

New cards
21

A hardware device that can cause a processor interrupt after some delay

hardware timer

New cards
22

The set of threads that are ready to be run

ready list

New cards
23

An operating system that provides the abstraction of a virtual machine, to run another operating system as an application

host OS

New cards
24

A software interrupt is also called

synchronous

New cards
25

A signal to the processor indicating an event needs immediate attention

interrupt

New cards
26

An interface between user process and OS is called

system call

New cards
27

Processor register points to the kernel memory area

interrupt vector table (IVT)

New cards
28

Returns child id to the reaping parent

wait()

New cards
29

Multiple activities happen at the same time

concurrency

New cards
30

Data structure that lives in kernel memory and contains thread specific information

thread control block (TCB)

New cards
31

Synchronization variable used by only one thread at a time

lock

New cards
32

Allow waiting inside a critical section

condition variables

New cards
33

When doing Posix pthread programming you need to include

pthread.h header file

New cards
34

Producer-consumer is an example of

one-way communication

New cards
35

Which one has an associated control block?
-process
-thread
-none
-both

both

New cards
36

Which one has a unique id?
-process
-thread
-none
-both

both

New cards
37

An operating system has two modes - user mode and kernel mode. Please select all true statements from the list below

-kernel is a fully trusted "central" part of an OS and has access to all the hardware
-process in user mode can request kernel to act on its behalf by making a system call
-mode bit in PSR can be only changed by kernel
-kernel mode allows to access any I/O device
-kernel mode allows process to execute with full privileges on the system's hardware

New cards
38

T/F All of the following are examples of system calls: fork(), read(), mkdir(), getpid(), open(), close(), and wait().

True

New cards
39

________ is software to manage computer resources for its users and applications that can often contain millions of lines of code.

operating system

New cards
40

T/F Concepts learned in the OS course will be applicable to many different fields of study within computer science and even other disciplines.

True

New cards
41

Three roles of an OS

illusionist, referee, glue

New cards
42

Difference between program and process

A program is an executable image that has both instructions and static data (initial values). A process is an instance of a program, running with limited rights

New cards
43

Memory areas of executable image =

data and instructions

New cards
44

What goes on heap and stack

shared objects (global variables(static), dynamically allocated objects) are on the heap, stack has local variables.

The heap memory is used for storing objects and data structures that require a longer lifespan than stack memory.

Each thread gets a stack, while there's typically only one heap for the application.

New cards
45

Difference between process and thread

processes and threads share a heap, data, and instructions
threads do not share a stack with process

New cards
46

how are processes identified

pid, an integer

New cards
47

how are threads identified

tid, long integer

New cards
48

How are process ids assigned?

assigned by system in order they are created

New cards
49

what is in 'proc' directory?

a folder for every running process

New cards
50

what does 'top' command do?

used to see all running processes and "demons"

New cards
51

what does 'htop' command do?

shows the same thing as 'top' command but color coded and 'ps' shows snapshot of processes (not live updated)

New cards
52

What is a kernel?

lowest level of OS software, it allows access to hardware in a controlled way via system calls

New cards
53

What does it mean that kernel is "interrupt driven"?

software and hardware can be interrupted anytime, interrupt is usually the switch between user mode and kernel mode

New cards
54

What receives an interrupt signal?

processor

New cards
55

What are the two kinds of interrupts?

software/synchronous and hardware/asynchronous
...why called that?

New cards
56

What will an interrupt execute?

an interrupt service routine or a handler

New cards
57

The interrupt vector table should be...

held in kernel memory and not arbitrarily changed by users

New cards
58

Can we overwrite interrupt handlers?

We can overwrite interrupt handlers from the table by writing our own signal handlers (use 'signal' call), signal call does not send a signal but just tells kernel what ISR to execute

New cards
59

What type of kernel does Linux have?

monolithic

New cards
60

Monolithic kernel

A monolithic kernel is an operating system architecture where the entire system runs in kernel mode. In this design, the kernel consists of a single, large executable that includes various services such as memory management, device drivers, file system management, and process management, among others.

New cards
61

Micro kernel

A microkernel is a type of operating system kernel that is designed to provide only the most basic services required for an operating system to function, such as memory management and process scheduling. Other services, such as device drivers and file systems, are implemented as user-level processes that communicate with the microkernel via message passing. This design allows the operating system to be more modular and flexible than traditional monolithic kernels, which implement all operating system services in kernel space.

New cards
62

Posix threads

POSIX - Portable Operating System Interface for Unix (defined in IEEE standard)
-It is a language-independent execution model using pthreads (POSIX threads) with >100 procedures for
--Thread creation/joining
--mutual exclusion
--condition variables
--synchronization

New cards
63

What is a fork bomb?

Program which harms a system by making it run out of memory (basically called fork too many times). A form of denial-of-service (DoS) attack against a Linux/Unix based system. The only solution to a fork bomb is to destroy all instances of it.

New cards
64

What is a condition variable?

Synchronization object that allows a thread to efficiently wait for a change in shared object that is protected by a lock.
-Called only when holding a lock
-Ex.: Wait until queue is non-empty to remove item instead of returning an error

Condition variables are synchronization primitives that enable threads to wait until a particular condition occurs. Condition variables are user-mode objects that cannot be shared across processes. Condition variables enable threads to atomically release a lock and enter the sleeping state.

New cards
65

What is a lock?

a primitive (synchronization variable stored in memory) that only one thread at a time can use.

New cards
66

Name several system calls

fork(), read(), mkdir(), getpid(), open(), close(), wait()

New cards

Explore top notes

note Note
studied byStudied by 5 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 60 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 1596 people
Updated ... ago
4.7 Stars(13)
note Note
studied byStudied by 9 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 44 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 7 people
Updated ... ago
4.0 Stars(222)
note Note
studied byStudied by 9 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 2280 people
Updated ... ago
4.7 Stars(7)

Explore top flashcards

flashcards Flashcard24 terms
studied byStudied by 2 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard83 terms
studied byStudied by 17 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard135 terms
studied byStudied by 236 people
Updated ... ago
5.0 Stars(6)
flashcards Flashcard94 terms
studied byStudied by 12 people
Updated ... ago
4.0 Stars(1)
flashcards Flashcard36 terms
studied byStudied by 9 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard33 terms
studied byStudied by 4 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard46 terms
studied byStudied by 44 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard155 terms
studied byStudied by 37 people
Updated ... ago
5.0 Stars(1)