OS exercises

1. Draw a process state transition diagram. And explain what each state is due to the time change.

 

2. The operating system is generally divided into several components, each part has what function ?

 

3. The user of a virtual memory space of a total of 32 pages, each page is 1KB , RAM is 16KB . Suppose a user's time a page table has been transferred to the memory page number and a physical block number table is as follows:

Page number

Physical block number

0

5

1

10

2

4

3

7

The logical address 0x0A5D what physical address corresponding to that?

 

4.  Suppose a total process . 8 pages, allocated . 4 physical memory blocks, the use of its pages as a list, if the process uses a FIFO replacement algorithm, draw process runs substituted FIG page, and indicated on FIG. whether the process feed.

1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 0

 

5.  Existing job, in the segment storage management system has a main memory allocated for establishing the segment table as follows:

Segment number

Main memory starting address

Length

0

120

40

1

760

30

2

480

20

3

370

20

 

Computing a logical address ( 2 , 15 ), ( 0 , 60 ), ( 3 , 18 ) of the absolute address is how much?

NOTE: The first element is the segment number in parentheses, the second element is the segment address.

 

6. There . 4 of processes executing concurrently A , B , C , D . They have read in the implementation of shared files F , but limits the process A and process B can not read the file at the same time F , process C and process D can not read the file at the same time F . Will the PV operation management:

(1) How should the definition of a semaphore ? Write semaphore initial value and meaning.

(2) Write a program to make them correctly executed.

 

7. What is the process? What is a thread? What is the difference between process and thread?

 

8. What is a deadlock? What is the reason and the necessary conditions for deadlock is?

 

9. assume a reading room for 50 people at the same reading. Readers must be registered when entering and leaving the reading room in a registration form at the entrance reading room, reading room has 50 seats, provision allows only one person or cancel registration.

Claim:

( 1 ) with PV operation process described algorithm reader (available flowchart showing the registration, cancellation of a natural language description is available);

( 2 ) indicated in the algorithm the name of the semaphore, and the initial value with the role.

 

11. The two concurrently executing processes A and B procedures are as follows:

Process A

  While (true) {

        temp = N

        temp = temp + 5

        N = temp;

  }

Process B

  While (true) {

        temp = N

    Print temp value;

        N=0

  }

Where N is an integer, the initial value of 4 . If process A after the first implementation of the three cycles, the process A and process B and concurrent execution of a cycle, write print the value that may arise. The right to print the value should be the number? Please P , V management operations, the processes A and B errors related to time does not appear concurrently.

 

12. In demand paging system, a user programming space 16 pages, each page 1K , memory space allocated to 8K . Suppose a time of the user's page table shown below, ask:

( 1 ) the logical address 084B ( H ) is a physical address corresponding to the number? (Hexadecimal)

( 2 ) the logical address 5000 (decimal) corresponds to the physical address is how much? (In decimal)

( 3 ) When the user process To access 24A0H when the unit, What will happen?

Page number

Physical block number

0

3

1

7

2

4

3

1

4

12

5

9

6

61

7

21

 

13. There is a buffer pool P , P contains 20 is available buffers, an external input data is read into the process P , the another one output process P data and outputs the extracted. When talking about the process for each operation are a write buffer synchronization algorithm in units of two processes, semaphores trial , asked to write the initial value of the semaphore.

 

14. There can hold a maximum of 2 cage of rabbits, rabbit hunter can only be placed in the cages (Load only 1 only), if the cage is full, the hunter must wait; only from the hotel owner take the rabbit cages (you can only remove 1 rats), if the cage is empty, then he must wait. Suppose initially empty cage. Define and initialize the semaphore, the use of P , V synchronization and mutual exclusion between the hunters and restaurateurs analog operation process.

 

15. There are two programs, A program in order to use the CPU 10S , using apparatus A 5S , using the CPU 5S , the device B using 10S , and finally use the CPU 10S . B program order using apparatus A 10S , using the CPU 10S , using the device B 5S , using the CPU 5S , the device B using 10S . In order to execute environment A program then execute B program, the CPU utilization is how much? Tip: the CPU usage = CPU running time / running time.

 

16. The provided system is only one printer, there are three user programs have to use the printer outputs the calculation result in the implementation process. Each user corresponds to a program set up process. Q: What kind of restrictive relationship between these three processes? The use of P , V operation of the algorithm using the printer write these processes.

 

17.  a station ticket office, any time can accommodate up to 20 name ticket to enter, when the ticket office in less than 20 Shi name ticket buyers, ticket holders can enter the hall immediately, or to wait outside. If a ticket buyers to as a process, with the PV managing these concurrent processes operate, how should the definition of semaphores, and write the initial value of the semaphore value of various meanings.

 

18. The table there is a plate, you can only put a fruit, Daddy special place to dish apple, orange mom designed to put a dish, such as a dedicated son to eat a dish of oranges, a daughter professionals and other eating dish Apple. With P - V operation to achieve their synchronization mechanism of this.

 

 

19. Implement front chemotactic relationship shown below with the semaphore.

 

 

20. The  following figure depicts the A, B, C, D total . 4 of processes using semaphores at a time sem operation, wherein the bold line is the process enters a critical region (i.e., the amount of signal obtained), the broken line is a process wait signal amount, the process is running thin line, without the use of semaphores.

 

please answer the following question:

1. semaphore sem initial value is the number, please say why.

2. tell us why (dotted line) of each process to be blocked.

3. 假设系统中只有这四个进程,在这10秒内,每个进程除了等待信号量,没有等待其他事件,如果系统共有3CPU,请计算下这10秒内系统的CPU使用率。

 

Guess you like

Origin www.cnblogs.com/wjw1014/p/11129649.html