Serie Memoire - Fr.en

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Translated from French to English - www.onlinedoctranslator.

com

Higher Normal School of Kouba second year computer science


Department of Computer Science Year 2022/2023

Exercise Series 6 (Memory Management) Operating system

Exercise 1 :
Consider a system with 32 MB of main memory. The resident part of the system is on 8 MB.
The processes arrive in the system in the following order:

Give the memory occupancy states to the different processing stages of these processes,
using the following algorithms:First FitAndBest-Fit. Remarks :
- Requests are satisfied in the order in which they arrive.
- In this system If a request is not satisfied, it is put on hold until the memory
is freed.
- When a process frees memory its part will be deleted
Exercise 2:
We consider a system on a uniprocessor machine with 16MB of physical memory, with the
resident part of the system on 4MB. Processes "arrive" in the system in the following order:

A process whose memory request is not satisfied is suspended.


1)Process scheduling is performed with the SJF algorithm.

To)Give the memory occupancy states and the Gantt chart at the different processing stages of
these processes, under the following assumptions:
- Fixed partitions of sizes: 6 MB, 4 MB, 2 MB and 4 MB (for the system);
- The memory allocator uses one process queue per partition.
Higher Normal School of Kouba second year computer science
Department of Computer Science Year 2022/2023

b)Calculate the waiting time for each process.

Exercise 3:
We consider a system whose user memory space has 1MB. Multiprogramming with variable
partitions is chosen for this system.

We assume the following chronology for our system.

Instant t Event
t=0 A(300, 55)
t=10 B(400, 35)
t=30 C(500, 35)
t=40 D(300, 105)
t=50 E(200, 35)
t=60 F(100, 55)
t=70 G(400, 35)
t=90 H(700, 35)
t=110 I(200, 25)
t=120 J(400, 45)

A process that cannot be loaded into memory is placed on a queue managed by a FIFO policy.
The first line of the table means that:

- process A arrives at time 0,

- the size of its logical space is 300 K and

- when process A is loaded into main memory, it will stay there (in main memory) for exactly 55
units of time.

Give the successive states of occupation and freeing of the memory if:

1.the allocation mode uses the first fit algorithm (First Fit).

2.the allocation mode uses the worst-fit algorithm (Worst Fit).

Exercise 4:

Sharing of pages Two users share a procedure in central memory. This procedure consists of 4
pages of 1000 bytes and occupies boxes 4000, 4500, 4501 and 6000 in the Central Memory. The
beginning of this procedure corresponds to:
- the logical address 4000 at user1,
- the logical address 0 at user2.
1.Explain, using diagrams, the realization of the sharing of this procedure.
2.User1 refers to bytes 0, 2048, and 3100 of the shared procedure. User2 refers to bytes 1050,
2048, and 3300 of the shared procedure. Give the virtual address (page, displacement) and the
physical address (box, displacement) to corresponding to each of the referenced bytes.
Higher Normal School of Kouba second year computer science
Department of Computer Science Year 2022/2023

Exercise 5:
Consider a system that uses allocation by variable partitions. We also speak of allocation by zones
when the size of the allocated zones is variable, or of allocations by blocks when the size of the allocated blocks
is fixed.

The allocation is made according to the first fit choice. That is to say that the first zone encountered whose size is greater
than or equal to the size of the process to be loaded is that which is allocated to the process.

We consider at time t the following state of the central memory:

Represent the evolution of the central memory according to the arrival of the following events:

1 - Arrival of program G (20 K) 2 -


Departure of program B
3 - Arrival of program H (15 K) 4 -
Departure of program E
5 - Arrival of program I (40 K)

Exercise 6:
We consider a system with 32 MB of real memory, with a resident part of the system
of 8 MB, and 6 processes which "arrive" in the following order:
Time of arrival of the request (in ms), Name of the process, Size of the partition requested, Duration of the
execution of the process.

Instant in ms Process Partition size Runtime

0 P0 10 MB 6ms

4 P1 6 MB 10ms

7 P2 2 MB 9ms

10 P3 10 MB 6ms

15 P4 14 MB 5ms

16 P5 10 MB 5ms

Question:
Give the memory occupancy states at the different processing stages of these processes,
assuming that the number of memory partitions is variable, with the following memory
allocation algorithms:
- First fit;
- Best fit;
- Worst-fit.
Noticed :
Higher Normal School of Kouba second year computer science
Department of Computer Science Year 2022/2023

If a request is not satisfied, it is put on hold until the memory is freed. Requests are satisfied in
the order in which they arrive.

Exercise 7:

Consider the list of virtual pages referenced at times t = 1, 2, ..., 11:

3 5 6 8 3 9 6 12 3 6 10

The main memory is made up of 4 initially empty boxes.

Represent the evolution of the central memory, as and when accesses, for each of the
two replacement policies of FIFO and LRU pages. Note any page faults.

Exercise 8:
We have a system with on-demand paging, using two algorithms A1and A2. During its
execution, a program successively accesses pages 1, 5, 2, 5, 1, 4, 1, 5, 3. The system allocates a
space of three pages to this program.

With Algorithm A1, we note that we have successively in memory the following pages:

1 1 1 1 1 2 1 1 1
5 2 2 2 4 2 4 3
5 5 5 5 4 5 5
With Algorithm A2, we note that we have successively in memory the following pages:

1 1 1 1 1 1 1 1 1
5 2 2 2 4 4 4 3
5 5 5 5 5 5 5
A- In your opinion, which of the two algorithms would correspond to the FIFO algorithm, and which would
correspond to LRU? Justify your reasoning.

B- Determine in each case the number of page faults.

Exercise 9:
The evaluation of the FIFO replacement algorithm on a 3-bin memory (physical pages), initially
empty, with the following sequence of referenced virtual pages:

7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1.

Each time we load a page into memory, we put its number in a queue.

7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1

7 7 7 2 2 2 4 4 4 0 0 0 7 7 7

0 0 0 3 3 3 2 2 2 1 1 1 0 0

1 1 1 0 0 0 3 3 3 2 2 2 1

X X X X X X X X X X X X X X X
Higher Normal School of Kouba second year computer science
Department of Computer Science Year 2022/2023

X: page fault.

1. Evaluate the LRU replacement algorithm, with the same sequence and number of bins;
2. For a memory with 3 compartments, and the following reference sequence:
1, 2, 3, 4, 1, 2, 5, 1, 5, 1, 2, 3, 4, 5.

Plot evolution for FIFO and LRU algorithms, noting page faults.
3.Repeat the same as b) with a number of squares equal to 4, and the same sequence.

You might also like