Operating Systems Exam 2

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Ways in which an application can be made available to run on multiple operating systems

1) The application can be written in an interpreted language (such as Python or Ruby) that has an interpreter available for multiple operating systems. 2)The application can be written in a language that includes a virtual machine containing the running application. 3)The application developer can use a standard language or API in which the compiler generates binaries in a machine- and operating-system- specific language.

Original versions of Apple's mobile iOS operating system provided no means of concurrent processing. Discuss three major complications that concurrent processing adds to an operating system.

1. The OS has to keep track of the main memory address space allocated to each process so that a process does not affect or harm other processes data. This is a necessary , for example, a virus may try to destroy or modify other process data. 2. Switching from one process to another process leads to time overhead(时间开销), this requires storing the current register values and loading the register values of the next process from its PCB(program Control Block). 3. If a running process requires large space in memory then other process needs to be dumped back to hard disk which again leads to time overhead.

Including the initial parent process, how many processes are created by the program shown in Figure 3.31?

8 processes

Boot process

A small piece of code known as the bootstrap program or boot loader locates the kernel. The kernel is loaded into memory and started. The kernel initializes hardware. The root file system is mounted.

Example of limited structuring

An example of such limited structuring is the original UNIX operating system, which consists of two separable parts: the kernel and the system programs. The kernel is further separated into a series of interfaces and device drivers, which have been added and expanded over the years as UNIX has evolved.

Chapter 2 Summary

An operating system provides an environment for the execution of pro- grams by providing services to users and programs. The three primary approaches for interacting with an operating system are (1) command interpreters, (2) graphical user interfaces, and (3) touch- screen interfaces. Systemcallsprovideaninterfacetotheservicesmadeavailablebyanoper- ating system. Programmers use a system call's application programming interface (API) for accessing system-call services. System calls can be divided into six major categories: (1) process control, (2) file management, (3) device management, (4) information maintenance, (5) communications, and (6) protection. The standard C library provides the system-call interface for UNIX and Linux systems. Operating systems also include a collection of system programs that pro- vide utilities to users. A linker combines several relocatable object modules into a single binary executable file. A loader loads the executable file into memory, where it becomes eligible to run on an available CPU. There are several reasons why applications are operating-system specific. These include different binary formats for program executables, different instruction sets for different CPUs, and system calls that vary from one operating system to another. An operating system is designed with specific goals in mind. These goals ultimately determine the operating system's policies. An operating system implements these policies through specific mechanisms. A monolithic operating system has no structure; all functionality is pro- vided in a single, static binary file that runs in a single address space. Although such systems are difficult to modify, their primary benefit is efficiency. A layered operating system is divided into a number of discrete layers, where the bottom layer is the hardware interface and the highest layer is the user interface. Although layered software systems have had some suc- Further Reading 101 cess, this approach is generally not ideal for designing operating systems due to performance problems. Themicrokernelapproachfordesigningoperatingsystemsusesaminimal kernel; most services run as user-level applications. Communication takes place via message passing. Amodularapproachfordesigningoperatingsystemsprovidesoperating- system services through modules that can be loaded and removed during run time. Many contemporary operating systems are constructed as hybrid systems using a combination of a monolithic kernel and modules. Abootloaderloadsanoperatingsystemintomemory,performsinitializa- tion, and begins system execution. The performance of an operating system can be monitored using either counters or tracing. Counters are a collection of system-wide or per- process statistics, while tracing follows the execution of a program through the operating system.

What is the main advantage of the layered approach to system design? What are the disadvantages of the layered approach?

As in all cases of modular design, designing an operating system in a modular way has several advantages. The system is easier to debug and modify because changes affect only limited sections of the system rather than touching all sections of the operating system. Information is kept only where it is needed and is accessible only within a defined and restricted area, so any bugs affecting that data must be limited to a specific module or layer.

How could a system be designed to allow a choice of operating systems from which to boot? What would the bootstrap program need to do?

Consider a system that would like to run both Windows XP and three different distributions of Linux (e.g., RedHat, Debian, and Mandrake). Each operating system will be stored on disk. During system boot-up, a special program (which we will call the boot manager) will determine which operating system to boot into. This means that rather initially booting to an operating system, the boot manager will first run during system startup. It is this boot manager that is responsible for determining which system to boot into. Typically boot managers must be stored at certain locations of the hard disk to be recognized during system startup. Boot managers often provide the user with a selection of systems to boot into; boot managers are also typically designed to boot into a default operating system if no choice is selected by the user.

Layered operating system

Each layer is implemented only with operations provided by lower-level layers. A layer does not need to know how these operations are implemented; it needs to know only what these operations do. Hence, each layer hides the existence of certain data structures, operations, and hardware from higher- level layers.

Challenges with the Operating System

Each operating system has a binary format for applications that dictates the layout of the header, instructions, and variables. Those components need to be at certain locations in specified structures within an executable file so the operating system can open the file and load the application for proper execution. CPUs have varying instruction sets, and only applications containing the appropriate instructions can execute correctly. Operating systems provide system calls that allow applications to request various activities, such as creating files and opening network connec- tions

What is the main advantage of the microkernel approach to system design? How do user programs and system services interact in a micro- kernel architecture? What are the disadvantages of using the microker- nel approach?

Extending the OS system is easier. Fewer changes needed when modifying the kernel

What executable file does a UNIX and LINUX system use?

For UNIX and Linux systems, the standard format is known as ELF. There are separate ELF formats for relocatable and executable files. One piece of information in the ELF file for executable files is the program's entry point, which contains the address of the first instruction to be executed when the program runs.

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

For certain devices, such as handheld PDAs and cellular telephones, a disk with a file system may not be available for the device. In this situation, the operating system must be stored in firmware.

What system calls have to be executed by a command interpreter or shell in order to start a new process on a UNIX system?

In Unix systems, a fork system call followed by an exec system call need to be performed to start a new process.The fork call clones the currently executing process, while the exec call overlays a new process based on a different executable over the calling process.

PCB (process control block)

It contains many pieces of information associated with a specific process

What is the purpose of the command interpreter? Why is it usually separate from the kernel?

It reads commands from the user or from a file of commands and executes them, usually by turning them into one or more system calls. It is usually not part of the kernel since the command interpreter is subject to changes

What are the advantages of using loadable kernel modules?

Loadable kernel modules have several advantages over monolithic "blobs" of code in the kernel: * Device drivers don't have to be hard-coded into the kernel

MACH System Calls

Mach provides fundamental operating- system services, including memory management, CPU scheduling, and inter- process communication (IPC) facilities such as message passing and remote procedure calls (RPCs).

Mechanism

Mechanisms determine how to do something;

Microkernel-based operating systems

Microkernel-based operating systems (discussed in Section 2.8.3) take the separation of mechanism and policy to one extreme by implementing a basic set of primitive building blocks. These blocks are almost policy free, allowing more advanced mechanisms and policies to be added via user-created kernel modules or user programs themselves.

Advantages of the microkernel

One benefit of the microkernel approach is that it makes extending the operating system easier. All new services are added to user space and conse- quently do not require modification of the kernel. When the kernel does have to be modified, the changes tend to be fewer, because the microkernel is a smaller kernel.The microkernel also provides more security and reliability, since most services are running as user—rather than kernel—processes.

The services and functions provided by an operating system can be divided into two main categories. Briefly describe the two categories, and discuss how they differ.

One class of services provided by an operating system is to enforce protection between different processes running concurrently in the system. Processes are allowed to access only those memory locations that are associated with their address spaces. Also, processes are not allowed to corrupt files associated with other users. A process is also not allowed to access devices directly without operating system intervention. The second class of services provided by an operating system is to provide new functionality that is not supported directly by the underlying hardware. Virtual memory and file systems are two such examples of new services provided by an operating system.

Using the program shown in Figure 3.30, explain what the output will be at LINE A.

PARENT: value = 5 Fork system call creates new process which is called as Child process and the process which called fork() function is called as Parent process

Policies

Policies determine what will be done.A change in policy would then require redefinition of only certain parameters of the system.The separation of policy and mechanism is important for flexibility. Policies are likely to change across places or over time. In the worst case, each change in policy would require a change in the underlying mechanism. A general

Layered level approach advantage

Simplicity of construction and debugging.

Steps for running a program on the CPU

Source files are compiled into object files that are designed to be loaded into any physical memory known as an relocatable object file. Next, the linker combines these relocatable object files into a single binary executable file. A loader is used to load the binary executable file into memory, where it is eligible to run on a CPU core.

What is the purpose of system calls?

System call provides the services of the operating system to the user programs via Application Program Interface(API). It provides an interface between a process and operating system to allow user-level processes to request services of the operating system.

What is the purpose of system programs?

System programs can be thought of as bundles of useful system calls. They provide basic functionality to users so that users do not need to write their own programs to solve common problems.

LINUX Operating System

The Linux operating system is based on UNIX and is structured similarly, as shown in Figure 2.13. Applications typically use the glibc standard C library when communicating with the system call interface to the kernel. The Linux kernel is monolithic in that it runs entirely in kernel mode in a single address space, but as we shall see in Section 2.8.4, it does have a modular design that allows the kernel to be modified during run time.

Implementation of OS (The advantages of using higher-level language for OS implementation

The code can be written faster, is more compact, and is easier to understand and debug. In addition, improvements in compiler technology will improve the gener- ated code for the entire operating system by simple recompilation. An operating system is far easier to port to other hardware if it is written in a higher-level language.

OS Design Problems

The first problem in designing a system is to define goals and specifications.

Once the process is allocated a CPU core and is executing, one of several events could occur:

The process could issue an I/O request and then be placed in an I/O wait queue. The process could create a new child process and then be placed in a wait queue while it awaits the child's termination. The process could be removed forcibly from the core, as a result of an interrupt or having its time slice expire, and be put back in the ready queue.

What happens when a program name is entered on the command line on UNIX systems?

The shell first creates a new process to run the program using the fork() system call. The shell then invokes the loader with the exec() system call, passing exec() the name of the executable file. The loader then loads the specified program into memory using the address space of the newly created process.

Monolithic structure

The simplest structure for organizing an operating system is no structure at all. That is, place all of the functionality of the kernel into a single, static binary file that runs in a single address space. This approach—known as a monolithic structure—is a common technique for designing operating systems.

How does a program run on a CPU?

To run on a CPU, the program must be brought into memory and placed in the context of a process.

User goals

Users want certain obvious properties in a system. The system should be convenient to use, easy to learn and to use, reliable, safe, and fast.

What executable file does a Mac and Windows system use?

Windows systems use the Portable Executable (PE) format, and macOS uses the Mach-O format.

Purpose of dynamically linked librariesDLLS)

Windows uses DLLS. The benefit of this approach is that it avoids linking and loading libraries that may end up not being used into an executable file.

Generating (or building) an operating system from scratch, you must follow these steps:

Write the operating system source code (or obtain previously written source code). Configure the operating system for the system on which it will run. Compile the operating system. Install the operating system. Boot the computer and its new operating system.

What are the three major activities of an operating system with regard to memory management?

a. Keep track of which parts of memory are currently being used and by whom. b. Decide which processes are to be loaded into memory when memory space becomes available. c. Allocate and deallocate memory space as needed.

application binary interface (ABI)

application binary interface (ABI) is used to define how different components of binary code can interface for a given operating system on a given architecture. An ABI specifies low-level details, including address width, methods of passing parameters to system calls, the organization of the run-time stack, the binary format of system libraries, and the size of data types, just to name a few.

Microkernels

microkernels provide minimal process and memory management, in addition to a communication facility The main function of the microkernel is to provide communication between the client program and the various services that are also running in user space.

Disadvantages of using higher-level language for OS

reduced speed and increased storage requirements.

(the users)

shells, commands, compilers, interpreters, and system libraries

system-call interface to the kernel

signals terminal handling character I/O system terminal devices file system swapping block I/O system disk and tape drivers CPU scheduling page replacement demand paging virtual memory

kernel nterface to the hardware

terminal controllers terminals device controllers disks and tapes memory controllers physical memory

What are the three major activities of an operating system with regard to secondary-storage management?

• Free-space management. • Storage allocation. • Disk scheduling.

Process State

• New. The process is being created. • Running.Instructions are being executed. • Waiting. The process is waiting for some event to occur (such as an I/O completion or reception of a signal). • Ready.The process is waiting to be assigned to a processor. Terminated.The process has finished execution.


Ensembles d'études connexes

Sociology Practice Exam Survey Research

View Set

NURS 612 Exam 1 (Perioperative, Diabetes, Endocrine)

View Set

Microsoft Excel, Microsoft Excel and Access Test Review, Excel, Excel, Microsoft Excel Fundamentals and Skills Project (BIM), Excel Essentials, Excel Fundamentals, EXCEL SKILLS, Microsoft Excel Fundamentals and Skills Project (BIM), True or False Exc...

View Set

When delivering 2022 Armada, what should you tell new owners will happen if the vehicle is not operated for 14 consecutive days?

View Set

Lost colony of Roanoke/ Jamestown

View Set