【操作系统】Operating System Concepts上机作业3

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

  • Free-space management;
  • storage allocation;
  • disk scheduling

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

  • Unix:fork()
  • Windows:CreateProcess()

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

2.9 List five services provided by an operating system, and explain how each creates convenience for users. In which cases would it be impossible for user-level programs to provide these services? Explain your answer.

  1. User interface. Almost all operating systems have a user interface
  2. Program execution. The system must be able to load a program into memory and to run that program, end its execution, either normally or abnormally (indicating error).
  3. I/O operations. A running program may require I/O, which may involve a file or an I/O device.
  4. File-system manipulation. programs need to read and write files and directories, create and delete them, search them, list file information, permission management.
  5. Communications. Process may exchange information, on the same computer or between computers over a network.

(6.Error detection. Os needs to be constantly aware of possible errors.)

Another set of operating system functions (such as resource allocation, accounting and protection and security) exists not for helping the user but rather for ensuring the efficient operation of the system itself. Systems with multiple users can gain efficiency by sharing the computer resources among the users.

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

For large operating systems (including most general-purpose operating systems like Windows, Mac OS X, and UNIX) or for systems that change frequently, the bootstrap loader is stored in firmware, and the operating system is on disk.
Some systems — such as cellular phones, tablets, and game consoles — store the entire operating system in firmware. Storing the operating system in ROM is suitable for small operating systems, simple supporting hardware, and rugged operation.
For certain devices, such as handheld PDAs and cellular telephones, a disk with a file system may be not be available for the device. ?

2.13 Describe three general methods for passing parameters to the operating system.

  1. pass the parameters in registers
  2. the parameters are generally stored in a block, or table, in memory, and the address of the block is passed as a parameter in a register
  3. Parameters also can be placed, or pushed, onto the stack by the program and popped off the stack by the operating system.

2.16 What are the advantages and disadvantages of using the same system- call interface for manipulating both files and devices?

Advantages

Each device can be accessed as though it was a file in the file system. Therefore, this benefits the development of both user program code, which can be written to access devices and files in the same manner, and device driver code, which can be written to support a well-defined API.

Disadvantage

it might be difficult to capture the functionality of certain devices within the context of the file access API, thereby resulting in either a loss of functionality or a loss of performance.

2.23 How are iOS and Android similar? How are they different?

Similarities

  1. Both are based on existing kernels (Linux and Mac OS X).
  2. Both have architecture that uses software stacks that provides a rich set of frameworks for developing mobile applications.
  3. Both provide frameworks for developers.

Difference

  1. iOS is designed to run on Apple mobile devices, and Android was developed for Android smartphones and tablet computers.
  2. iOS is closed-source, and Android is open-source.
  3. iOS applications are developed in Objective-C, Android in Java.
  4. Android uses a virtual machine, and iOS executes code natively.

2.24 Explain why Java programs running on Android systems do not use the standard Java API and virtual machine.

Rather than using the standard Java API, Google has designed a separate Android API for Java development. The Java class files are first compiled to Java byte code and then translated into an executable file that runs on the Dalvik virtual machine. The Dalvik virtual machine was designed for Android and is optimized for mobile devices with limited memory and CPU processing capabilities.

3.1 Using the program shown in Figure 3.30, explain what the output will

be at LINE A.
The output will be 5. When a process creates a new process, the child process is a duplicate of the parent process and the child process has a new program loaded into it.So the result is still 5 because the child process has a copy of its value.

3.2 Including the initial parent process, how many processes are created by

the program shown in Figure 3.31?
8. When the fock() function is called, each process will have a new child process.

3.5 When a process creates a new process using the fork() operation, which of the following states is shared between the parent process and the child process?

a. Stack b. Heap
c. Shared memory segments
Shared memory segments will be shared between the parent process and the child process.Heap and stack will not be shared, the child process will have its own copy.

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
操作系统是计算机系统中最基本的软件之一,它负责管理和协调计算机硬件资源,提供更高层次的抽象,使用户能够方便地使用计算机。操作系统的主要功能包括进程管理,内存管理,文件系统管理和设备管理。 进程管理是操作系统的核心功能之一。它负责创建、终止和调度进程,以及管理进程之间的通信和同步。通过进程管理,操作系统可以控制程序的执行顺序,保证多个程序可以同时运行,并且能够相互合作。 内存管理是操作系统的另一个重要功能。它负责管理计算机的内存资源,将内存划分为多个区域,为进程分配内存空间,并且提供内存的分配和回收功能。内存管理还负责虚拟内存的实现,通过将部分程序从内存中换出到磁盘上的交换区,实现了对内存资源的合理利用。 文件系统管理是操作系统的一个关键组成部分。它提供了一种组织和存储文件的方式,使得用户可以通过文件名来访问和管理文件。文件系统管理还包括文件的创建、删除、复制和移动等操作,以及对文件的读写权限的管理。 设备管理是操作系统的另一个重要功能。它负责管理计算机的输入输出设备,包括硬盘、键盘、鼠标、打印机等。设备管理还负责调度和控制设备的访问,以保证多个设备可以同时进行操作,并且能够高效地响应用户的请求。 操作系统还提供了用户接口,使用户能够方便地与计算机进行交互。用户可以通过命令行界面或者图形界面来操作计算机,执行各种任务,如运行程序、管理文件、配置系统等。 总而言之,操作系统是计算机系统中的一个关键组成部分,它负责管理和协调计算机的各种资源,为用户提供一个方便、高效和可靠的计算环境。操作系统的功能包括进程管理、内存管理、文件系统管理和设备管理,通过这些功能,操作系统可以实现对计算机的全面控制和管理。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值