OS Midterm

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

What are the three major functions of an OS?

1. Resource management: allocates separate resources of the computer to perform required tasks in an efficient manner 2. Control program: supervises the execution of user programs to prevent errors and improper use; and supervises the operation and control of I/O devices 3. Convenient Environment: allows a user to execute programs on computer hardware in an efficient manner

Power-off state to running state steps

1. bootstrap program locates kernel 2. loads into memory, and starts it 3. kernel initializes hardware 4. root file system is mounted

describe three general methods for passing parameters to the OS in a system call.

1. fork() - Used to create a copy of the parent process into a child process. It can then execute (using exec()) an executable file in the context of this already existing process. 2. Exec() - Used to run an executable file in the context of an already existing process. It essentially replaces the current process rather than copying it (like fork() does). 3. Pipe() - This provides a connection between to processes, such that the I/O of one process becomes the I/O of another process. It essentially provides communication between two processes.

What is a function prototype and when is it needed.

A Function Prototype is a declaration of the file that specifies the functions name and type signature (number of args, data types of args, return type) but omits the function body. This is often used in C/C++ to define functions in header files and the actual implementation of these functions in C or CPP files in order to split a program into parts in which the compiler can separately translate into object files to be combined by a linker into an executable or library.

Explain the difference between a monolithic kernel and a microkernel.

A Monolithic Kernel is the entire kernel process running in a single address space. A Microkernel can be broken down into user level programs that reside in separate address spaces.

What is the purpose of system calls, and how do system calls relate to the OS and to the concept of dual-mode (kernel mode and user mode) operation?

Allow user-level processes to request services of the operating system. They serve as the connection between the two modes.

What is virtual memory? Why is it used on most modern operating systems?

Allows the execution of a process that is not completely in memory. It is used because it allows users to run programs that are larger than the actual physical memory

Consider whether the operating system should include applications such as web browsers and mail programs. Argue both that it should and that it should not, and support your answers.

An argument in favor of including popular applications in the operating system is that if the application is embedded within the operating system, it is likely to be better able to take advantage of features in the kernel and therefore have performance advantages over an application that runs outside of the kernel. Arguments against embedding applications within the operating system typically dominate, however: (1) the applications are applications—not part of an operating system, (2) any performance benefits of running within the kernel are offset by security vulnerabilities, and (3) inclusion of applications leads to a bloated operating system.

What do you know about BIOS? In the class we discussed that PC/BIOS PROM monitor is rather limited in its ability to access the system hardware. What new standard is being proposed to replace the traditional legacy BIOS?

BIOS stands for Basic Input/Output System and is firmware used to perform hardware initialization during the booting process of a PC. It also provides runtime services for operating systems and programs. It comes pre-installed or 'flashed' onto a computers motherboard which is provided by the board's manufacturer. It is the first software to run when the PC is powered on. It is responsible for initializing system hardware components as well as loading the bootloader from the first block of a mass storage device on which it is contained. The new standard proposed to replace BIOS is UEFI (Unified Extensible Firmware Interface). It is a single complete boot manager, and is therefore faster than the multistage BIOS.

What do you mean by big-endian and little-endian system?

Big Endian Byte Order - The most significant byte of data is placed at the byte with the lowest address. Little Endian Byte Order - The least significant byte of data is placed at the byte with the lowest address.

In operating system terminology (and not in data structure terminology) what is heap and what is stack?

Heap: memory that is dynamically allocated during program run time Stack: temporary data storage when invoking functions (parameters, return addresses, and local variables)

What are the two models of inter process communication? What are the strengths and weaknesses of the two approaches?

In the Shared Memory model, a region of memory which is shared by cooperating processes gets established. Processes can then be able to exchange information by reading and writing all the data to the shared region. Strengths: fast and direct. Weaknesses: Unexpected behavior when unauthenticated programs access the shared memory segments. In the Message Passing model, communication takes places by way of messages exchanged among the cooperating processes. Strengths: program structured better separated, dangerous operations firewalled. Weaknesses: slower communication.

What is POST?

In the context of Operating Systems, POST stands for Power On Self Test and is a process performed by software routines immediately after a device is powered on. Checks whether there are any hardware issues.

What is the purpose of the command interpreter? Why is it usually separate from the kernel? Would it be possible for the user to develop a new command interpreter using the system-call interface provided by the operating system?

It reads commands from the user or from a file of commands and executes them, usually by turning them into system calls. It isn't part of the kernel because it's subject to changes.It is possible to develop a new command interpreter using the system-call interface in OS's where the interpreter is not tightly integrated into the system (i.e., Most OSs other than Windows). The Unix family of OSs provides multiple interpreters, for example (sh, bash, csh)

What do you mean by LILO and GRUB?

LILO (Linux Loader) is a boot loader for Linux. (was the default for years) GRUB (Grand Unified Bootloader) is a common open-source bootstrap loader that allows selection of boot partitions and options to be passed to the selected kernel.

How are multiple interrupts dealt with? Can traps be generated intentionally by a user program? If so, for what purpose?

Software assigns each interrupt to a handler in the interrupt table. An interrupt handler is just a routine containing a sequence of operations. Yes. They could be generated to signal the completion of an I/O operation to prevent the need for device polling. (getting the status of a hardware device)

Why do some operating systems store the operating system in firmware, while others store it on disk?

Some have the availability of a disk with a proper file system, while others do not.

What is the difference between source code, pseudo code, and an algorithm.

Source Code is the underlying code used to develop a given program. It can be used to build and deploy executable programs using a given compiler. Pseudo Code is 'human-readable' code that is not 'machine-executable'. It is often written in shorthand English (or whichever language the programmer chooses) and provides an abstracted description of how a program should work. An Algorithm is a process or set of rules in which (in the context of computer programming) can be used by a program to solve a problem or make a calculation.

Describe the difference between syntax and semantic errors. How do you detect them? How do you fix them?

Syntax Errors are errors that are caused by writing code in a given language that is not valid given the languages' set of syntactical rules. These errors are often highlighted by the programmer's IDE or compiler and will usually provide information during compilation or runtime that contains an ID representing the type of error and a brief description of the error and its location in the source code. You can fix these errors by changing the given mistakes in your code to fit the given langue's' rules. Semantic Errors - These errors are usually runtime errors that cause your program to run in a way in which you did not intend. These errors are often harder to detect as they often do not cause any issues with the compiler and can still fall under the syntactical rules provided by a given language. You can fix these by focusing on changing the 'logic' of your code.

Briefly describe the difference between compiling and linking phases involved in creating an executable from a C++ program.

The compilation phase involves translating program source code into low level machine code. The compiler takes the preprocessed file and generates an object file containing low-level code. This file contains lines of instructions translated to the machine level. Errors in compilation are often syntactical. The linking phase is the phase in which a single executable file is created from (possibly) multiple object files. The file created by the linker can be loaded into memory and executed by the system. Errors in linking are often related to the given object files not working together.

From a Linux perspective, briefly (2 sentences) describe the use of user id (a number) and group id (a number)

The number values used to represent a user id is called a User Identifier (UID) and the number to identify the group id is called a Group Identifier (GID), these are used to determine which system resources a user or group can access.

What is the purpose of the UNIX pipe command, i.e., vertical bar character |

The pipe command (represented with |) is used to send the output of one program to another program as input

Explain the Role of the Linker and Loader (g++ -o -c etc.)

The role of the Linker is to turn object code provided by the compiler into executable files that can be then used by the Loader to load the given executable into memory.

What are the differences between a trap and an interrupt? What is the use of each function?

Trap is a software interrupt. Can be caused by an error (div. by 0) or a specific request from a user-program that an OS service be performed. programmer initiated and expected transfer of control to a special handler routine. (e.g., 80x86 INT) Interrupt: A hardware mechanism that enables a device to notify the CPU that it needs attention. (e.g., Pressing a key or a time out on a timer)

3 Linux file security levels

User, Group, Other Permission(s)

What does it mean to preempt a process?

When a process is preempted, the system changes the processes' execution on the CPU. This occurs through interrupts.

Briefly (2 to 3 sentences each) discuss pass-by-value versus pass-by-reference mechanisms for passing parameters to methods.

When you pass a parameter by value, you are creating a copy in memory of the actual parameters value that is passed in. Essentially creating a copy of the contents of the parameter. This should be used only when you are 'using' the parameter for some kind of computation and not changing it for the program. This, for obvious reasons, uses more memory. When you pass a parameter by reference, you are creating a copy of the memory address where the actual parameter is stored. You can use this when you are changing a parameter used by the program.

Can UNIX fork() and exec() return an error?

Yes. fork() returns and error when a process needs resources or a PID to create a child. exec() returns an error when there is not enough memory allocated

what is direct memory access (DMA)

a feature of a computer system that allows certain hardware to access main system memory (RAM) independent of CPU intervention

host vs. guest OS

a host OS runs directly on hardware while a guest OS is a virtualization of the host

Shell

a program that allows a user to access an operating system's services through input commands

process

an "active program" that is being executed on one or more threads

batch vs. interactive OS

batch is 'non-interactive' as they can be run without manual/user interaction; interactive prompt the user for input data or commands

what is IRQ?

interrupt request; hardware signal sent to the processor that temporarily stops a running program and allows a special program (interrupt handler) to run instead; used to handle events such as key presses, mouse movements, modem data, etc

Where is a boot loader found in memory?

it's found in the first available memory block (aka 'boot sector') of a bootable medium

boot loader

loads an OS' kernel into memory, performs initialization, and begins system execution

proprietary vs. open OS

proprietary OS' have rights reserved while Open OS' can be used, modified, and distributed by anyone

why is 2-state boot loading used?

the initial boot loader has limited size since ROM is fairly small. this first boot loader starts other, more complex processes which don't have the same constraints

What does chmod do?

used to change access permissions for a file; 0-7 gives user, group, and other specific privileges

what is a system call?

where a computer program requests a service from the kernel of the OS on which it is executed. A system call provides the service of an OS to the program via an API

what is a 2 stage boot loader?

where an initial boot loader does nothing more than load a second loader at a fixed disk location called the 'boot-block'; usually is just simple code which knows the address and the length of the remaining bootstrap program


Set pelajaran terkait

HESI Dosage Calculations Practice Exam, Hesi Pharmacology Review

View Set

Module 5: Corporate & Global Strategy

View Set

ATI reproductive and genitourinary

View Set