Looks like no one added any tags here yet for you.
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
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
One of the roles of an OS is to act as an "illusionist". It makes your computer appear more
powerful
What memory regions do threads share within the same process?
data, instruction, heap. NOT stack, stack is divided among threads
T/F Threads are more expensive for the operating system kernel to create than processes
False
T/F An operating system should never create more processes than the available number of processors
False
T/F Linux is an example of a monolithic kernel
True
T/F The interrupt vector table should be held in kernel memory and not arbitrarily changed by users
True
T/F A command interpreter on the Linux system is also known as a shell
True
T/F fork() in Linux creates a child process, which then executes the function that is passed as an argument
False
T/F When you are programming with Posix pthreads there are several different exec() calls with different arguments
True
T/F Dana makes 8 calls to fork() in main. This is called a fork bomb.
False
T/F Threads created by a single process share the same memory address space
True
What piece of code goes on the line below?
check test
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
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
In the code segment below, what is printed on line 12?
check test
An operating system running in a virtual machine
guest OS
A kernel procedure invoked when an interrupt occurs
interrupt handler
Instruction available in kernel mode but not in user mode
privileged instruction
A hardware device that can cause a processor interrupt after some delay
hardware timer
The set of threads that are ready to be run
ready list
An operating system that provides the abstraction of a virtual machine, to run another operating system as an application
host OS
A software interrupt is also called
synchronous
A signal to the processor indicating an event needs immediate attention
interrupt
An interface between user process and OS is called
system call
Processor register points to the kernel memory area
interrupt vector table (IVT)
Returns child id to the reaping parent
wait()
Multiple activities happen at the same time
concurrency
Data structure that lives in kernel memory and contains thread specific information
thread control block (TCB)
Synchronization variable used by only one thread at a time
lock
Allow waiting inside a critical section
condition variables
When doing Posix pthread programming you need to include
pthread.h header file
Producer-consumer is an example of
one-way communication
Which one has an associated control block?
-process
-thread
-none
-both
both
Which one has a unique id?
-process
-thread
-none
-both
both
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
T/F All of the following are examples of system calls: fork(), read(), mkdir(), getpid(), open(), close(), and wait().
True
________ is software to manage computer resources for its users and applications that can often contain millions of lines of code.
operating system
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
Three roles of an OS
illusionist, referee, glue
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
Memory areas of executable image =
data and instructions
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.
Difference between process and thread
processes and threads share a heap, data, and instructions
threads do not share a stack with process
how are processes identified
pid, an integer
how are threads identified
tid, long integer
How are process ids assigned?
assigned by system in order they are created
what is in 'proc' directory?
a folder for every running process
what does 'top' command do?
used to see all running processes and "demons"
what does 'htop' command do?
shows the same thing as 'top' command but color coded and 'ps' shows snapshot of processes (not live updated)
What is a kernel?
lowest level of OS software, it allows access to hardware in a controlled way via system calls
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
What receives an interrupt signal?
processor
What are the two kinds of interrupts?
software/synchronous and hardware/asynchronous
...why called that?
What will an interrupt execute?
an interrupt service routine or a handler
The interrupt vector table should be...
held in kernel memory and not arbitrarily changed by users
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
What type of kernel does Linux have?
monolithic
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.
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.
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
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.
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.
What is a lock?
a primitive (synchronization variable stored in memory) that only one thread at a time can use.
Name several system calls
fork(), read(), mkdir(), getpid(), open(), close(), wait()