OS Test 1

¡Supera tus tareas y exámenes ahora con Quizwiz!

What are some of the characteristics of a graphical user interface?

It supports a desktop, with icons for files and programs. The user uses a mouse to interact with the various icons.

Consider the traditional UNIX system structure. Are shells and compilers part of the kernel? If not, what are they?

No. They are system programs.

What is meant by a "dual core" CPU?

This is a single chip, containing two CPUs, each of which is referred to as a CPU core.

In a typical computer system with multiple I/O devices, the CPU initiates an I/O operation and then needs to know when the operation has finished. a. One method for finding out when the operation has finished is software polling, which requires the CPU to continuously poll that I/O device to find out if it has finished. What is the main disadvantage of this techniques? b. Another method for finding out when the operation has finished is to use hardware interrupts, which requires the I/O device to send an interrupt signal when it has finished. What is the main advantage of this techniques?

a. It wastes the CPU's time to keep checking on the status. b. The CPU can continue to do useful work until the I/O device actually needs its attention.

Program Counter

holds address of the next instruction to execute

An important innovation in bringing computing to the masses was interactive timesharing. Define timesharing. (Multitasking)

(Multitasking) In a time-shared system, multiple users connect to one computer, but the OS switches rapidly between their various processes, giving each user rapid response time and the illusion of a dedicated computer.

What is a system call?

A mechanism for the program to request services from the operating system, generally services which only the OS can provide, such as access to memory, I/O devices, etc.

Silberschatz says that most users' view of the operating system is defined by system programs, not actual system calls. Explain

A normal user would never use the system calls directly, but would instead use application programs or system programs, which in turn make system calls. Thus most users see the "operating system" as a set of system programs.

In many cases, the operating system must distinguish between a policy and a mechanism. What is the distinction between these two?

A policy says what will be done, while the mechanism says how it will be done. For example, give each process 100ms to run is a policy, while implementing it using a timer and interrupts is a mechanism.

Operating System

A program that acts as an intermediary between a user of a computer and the computer hardware OS is a resource allocator - manages resources fairly, efficiently; OS is a control program - controls execution of programs

What is the difference between a system call and a system program?

A system call is a specific type of procedure call, which can be made from a user program, system program, or in the OS kernel. A system program is an entire program, but is more system oriented and is one which the user would expect to be provided along with the OS — such as a text editor, compiler, web server, etc.

What is the relationship between a system call and a trap?

A system call is implemented using a trap, which is a software-generated interrupt. The trap handler contains the code for the system call. APIs are often standard across multiple systems.

Arithmetic Logic Unit

ALU - performs arithmetic and logical (comparison) operations

What is the relationship between Application Programming Interfaces (APIs) and system calls?

APIs are usually higher-level functions; an API is typically composed of multiple system calls. Application programmers typically use APIs instead of system calls.

. What is the similarity between a system call and an interrupt?

Both occur at (to the operating system) unpredictable times, and interrupt it from what it might be doing otherwise. Both use the CPU's interrupt mechanism of going through a vector table to a service routine dedicated to that time of request. In a sense, a system call executes a trap instruction, which is a software-triggered interrupt (whereas a "normal" interrupt is hardware triggered).

One of the services provided by an operating system is a file system. What functionality might a file system provide?

Create and use directories, place directories and files inside of directories, create and use files, list files, manage files, etc.

In an operating system, what is meant by security? (

Defending the system against internal or external attacks, such as worms, viruses, or denialof-service attacks.

Computer System Structure

Four components: Hardware - CPU, memory, I/O Devices Operating System - Controls and coordinates use of hardware among various applications and users Application Programs - define the ways in which the system resources are used to solve the computing problems of the users - Word processors, compilers, web browsers, database systems, videogames, etc Users - people, machines, other computers

Instruction Register

IR - instruction being executed

Two methods that the CPU can use to determine when an I/O operation finishes are polling and vectored interrupts. Briefly describe how this is accomplished with each method.

In polling, the CPU starts the I/O operation and then repeatedly (i.e., in a loop) checks a bit in the status register on the I/O device; that bit is set by the I/O device when the I/O operation finishes. With vectored interrupts, the CPU starts the I/O operation and then goes on to other tasks, When the I/O operation finishes, the I/O device sends an interrupt to the CPU. Each type of interrupt is sent by the CPU, though the interrupt vector table, to an interrupt service routine appropriate for that type of interrupt where that interrupt is processed.

What is the benefit of giving an I/O device Direct Memory Access (DMA)?

It allows that device to directly transfer data into a memory buffer allocated by the OS, without involving the CPU. This lets the CPU proceed asynchronously, executing other code, while the I/O devices is transferring data to memory.

A partial definition of an operating system is that it is a "control program". What does it control, and why?

It controls the execution of programs to prevent errors and improper use of the computer.

In the CPU, what is the role of the Program Counter (PC)?

It holds the address of the next instruction to be executed.

What is the interrupt vector and how is it used?

It is a table of addresses to the interrupt handlers, and is indexed by the interrupt's number. It is used to find the code to process that particular interrupt.

What functions does a command line interpreter provide?

It lets the user enter textual commands, primarily to execute programs, but also to run analyses, list files, etc.

A partial definition of an operating system is that it is a "resource allocator". Explain.

It manages key resources (CPU, memory, I/O devices, disk/files) and allocates them to programs in some fair and efficient manner.

The next step beyond the microkernel system structure is a kernel implemented as "loadable kernel modules". Explain what this term means.

It means the kernel is structured as a set of modules, using an object-oriented approach, with separation of information, communication over fixed interfaces, etc. Each module is also loaded only when and if it is needed.

In a typical computer system, the I/O devices and the CPU are executing concurrently. Explain what that means, and give an example.

It means they are executing at the same time. While the CPU is executing instructions, the I/O devices may be reading from some input device(s), writing to some output device(s), and reading or writing files - all at the same time.

In the CPU, what is the role of the Arithmetic Logic Unit (ALU)?

It performs arithmetic and logical operations on the values in the registers.

In a typical computer system with multiple I/O devices, the CPU initiates an I/O operation and then waits for an interrupt to indicate that the I/O has finished. What does the CPU do when it receives that interrupt to process the result of the I/O operation?

It saves the CPU's current state (PC and SP), uses the interrupt vector to find the appropriate interrupt handler for that I/O operation, executes the code in that interrupt handler to processes the result of the I/O operation, restores the CPU state, and returns to the previous point of execution.

What are some of the characteristics of a graphical user interface?

It supports a desktop, with icons for files and programs. The user uses a mouse to interact with the various icons - running programs, opening folders, etc.

Most modern operating systems have taken a microkernel approach. What is the basic idea of the microkernel?

Make the microkernel as small as possible by moving functionality from the kernel into system programs (which run in user space).

Define "multiprogramming".

Multiprogramming refers to the OS keeping multiple programs in memory, switching from one to another when the one running has to wait on some event.

Explain multitasking and multiprogramming. How are they similar? Different?

Multiprogramming refers to the OS keeping multiple programs in memory, switching from one to another when the one running has to wait on some event. Multitasking (time sharing) is similar, but the OS also switches between the programs after short time intervals to give the illusion of all the programs "running" at the same time. This rapid switching is generally necessary in an interactive environment to provide acceptable response time to the user They are similar that both types of systems allow multiple jobs to be in the machine, in memory, and "executing" at the same time. With both, when a process has to wait (i.e., on I/O), the system switches to another process. They differ in that multitasking / timesharing adds a concern for the user's response time, typically switching between processes rapidly enough to permit interactive computing.

What is meant by multitasking?

Multitasking refers to the OS keeping multiple programs in memory, and switching between them quickly to give the illusion of all the programs "running" at the same time. This rapid switching is generally necessary in an interactive environment to provide acceptable response time to the user

General Purpose Registers

R1, R2, etc. - hold arithmetic operands and results

Stack Pointer

SP - Address of current location in the stack

Most modern CPUs provide support for hardware-generated interrupts and software generated traps. In what ways are these two similar? In what ways are these two different?

Similar: Both stop what they are currently doing, save state, use the interrupt service vector, perform the requested operation, restore state, and then resume program execution. Different: Interrupts are generated by hardware at unpredictable times; traps are generated by software when a TRAP instruction is executed. Traps also set kernel mode before performing the requested action, and then set user mode before returning.

What is a system program?

System programs are programs supplied along with the OS to supplement the OS kernel and providing an environment for entering text, data, and program code, as well as compiling and testing programs. Typical examples are text editors, program development environments, compilers, and debuggers. The term is rather fuzzy, however, so some may also consider email clients, browsers, file managers, and other application programs supplied along with the OS to be system programs.

What is a system program? Define the term and provide a few examples of system programs.

System programs are programs that ship with the operating system and supplement its kernel, providing system-like services such as a file system, software development environment, methods for communication, and various background services. In the Unix world, system code above the system-call interface is a system program, and below that interface is the kernel. Programs such as email clients, web browsers, text editors, etc. are usually considered system programs.

A CPU can communicate with I/O devices in a variety of ways, one of which is softwarepolling synchronous I/O. a. Briefly define software-polling synchronous I/O. b. Why is this technique not ideal?

The OS starts an I/O operation, then continuously checks ("polls") that I/O device until the I/O operation finishes. During this time the CPU busy-waits, rather than doing useful work. It wastes CPU time looping and checking, instead of doing useful work executing another process while the I/O proceeds.

System calls provide access to operating system services, but often require input data or return results. One common approach is to pass these parameters via a block of memory. How does the system call know where to find this block of memory?

The address to the memory block is passed to the system call in a register.

Consider the traditional UNIX system structure. How is the "kernel" defined?

The kernel is everything below the system call interface and above the hardware.

How is a microkernel different from the larger kernels in early versions of UNIX?

The large kernels consisted of a large body of code that executed in kernel mode, providing many machine-dependent and machine-independent services. In contrast, microkernels have a much smaller body of code that runs in kernel mode, supplementing that small microkernel with a set of OS progresses that can run in user mode. As an example, the large kernel would include the entire file system and disk management system in the kernel, while the microkernel would put much of that functionality into user mode, reserving only those portions that actually need to access the memory or disk for kernel mode.

What is the distinction between application programs, system programs, and the microkernel in a micro-kernel-based OS such as Mach?

The micro-kernel is the "minimal" kernel possible, consisting of only those few core services that must run in privileged (kernel) mode. The rest of the "OS" — that portion which can run in user mode — is considered to by system processes / programs. Application programs are the non-OS programs such as word processors, multimedia players, and games.

One of the services that the operation system provides for users is program execution. What does that mean?

The operating system can load a program into memory, start it executing, give it CPU time, and run it until it ends normally or ends with some sort of error.

The next step beyond micokernels was the modular approach. How was the operating system structured with this approach?

There is still a micro-kernel, but now it is structured as a set of modules. Further, each module is only loaded when it is needed.

The basic idea of the microkernel is to make the kernel as small as possible, keeping just the functions that need to run in kernel mode, such as CPU scheduling and memory management. What happens to other functions, such as the file system or the graphical user interface?

They get moved out of the kernel into system programs, which run in user mode and make system calls when necessary, and which can communicate with other systems programs via message passing.

When a computer system is turned on, the CPU starts by running a small piece of code, which in turn loads the rest of the operating system. What is this code called, and where is it found?

This code is called the bootstrap, or bootstrap program, or bootstrap loader, and it is stored in ROM or EEPROM memory.

I/O devices typically communicate their completion of an I/O operation to the CPU through interrupts. a. What is the role of the interrupt vector? b. How are interrupts similar to traps?

When an interrupt occurs, the interrupt vector is used to look up the "type" of interrupt, after which the CPU goes into kernel mode and transfers control to the proper interrupt service routine. All this is done under hardware control as part of responding to the interrupt. A trap is simply a software-generated interrupt, caused by the execution of a TRAP instruction. Depending on the operand of the TRAP, control is transferred through the interrupt vector to the proper service routine after going into kernel mode — exactly the same as a hardware-generated interrupt.

In a modern CPU, one or more caches are placed between the CPU and memory to improve performance. How does the cache improve performance?

When the CPU reads data from memory, it first checks the cache, and if the data is there, it is returned to the CPU much faster than if the data had to be retrieved from memory.

. What is the difference between synchronous I/O and asynchronous I/O, and in what way is asynchronous I/O "better"?

With synchronous I/O, the CPU initiates an I/O operation and then waits until the I/O operation completes, whereas with asynchronous I/O, the CPU continues executing instructions while the I/O operation proceeds concurrently. Asynchronous I/O is better because it allows the CPU to do useful work during the I/O operation, instead of just waiting.

When the CPU reads data from memory, it takes much longer to read from memory than from registers, so a cache is used to help improve performance. a. What happens if the data needed is in the cache? b. What happens if the data needed is not in the cache?

a. It is returned to the CPU, and the memory is not accessed. b. The data is read from the memory, and a copy is placed in the cache for the next time it is needed.

Most modern CPUs provide both user mode and privileged (kernel) mode instructions. a. Why is it necessary to differentiate between two sets of instructions in this manner? b. Explain how the CPU transitions from user mode to kernel mode and vice-versa.

a. The privileged instructions access machine functions, such as I/O and memory control, which should be restricted to authorized use only. Thus user programs and OS support programs are only permitted to use user mode instructions, while the OS kernel is permitted to use both user mode and privileged mode instructions. b. When a user process makes a system call, a trap (software-generated interrupt) occurs, which causes (1) the appropriate trap handler to be invoked and (2) kernel mode to be set. This is the only method for the CPU to go into kernel mode. When the trap handler finishes, user mode is set as control returns to the calling process. Note that it's important to realize that a user program can not just put itself into kernel mode; going into kernel mode is a CPU function that happens only through one carefully-managed mechanism (the OS's set of traps).

Most modern CPUs make a distinction between user mode and kernel mode. a. How does the CPU get into kernel mode? b. What can the CPU do in kernel mode that it cannot do in user mode?

a. When the program executes a TRAP instruction, the CPU sets kernel mode (along with calling the appropriate trap handler). b. It can execute privileged instructions, which can access I/O devices, control interrupts, change the memory state, and change the mode.

Control Unit

controls ALU operation; moves values between registers, ALU, and main memory


Conjuntos de estudio relacionados

Nut 10 - : Chapter 11 + 12 from Nutrition Basics for Better Health and Performance

View Set

Distance and displacement problems- ENR

View Set

Life Insurance and Health Rules Pertinent to Life Insurance Only

View Set

UNIT 10: BUILD INTERACTIVE LESSONS

View Set

Ross Immunology True/False Practice Exam 2

View Set

Final Exam Review for Chapters 1-5

View Set

NUR 410 PEDS PREPU, interv week 6 peds, PN108 PrepU Chapter 39, Ricci Chapter 43: Nursing Care of the Child With an Alteration in Urinary Elimination/Genitourinary Disorder

View Set