CIT3002 Programming Assignment

UNIVERSITY OF TECHNOLOGY, JAMAICA 
SCHOOL OF COMPUTING & INFORMATION TECHNOLOGY 
Operating Systems (CIT3002) PROGRAMMING ASSIGNMENT 

The operating system is an interface between the user and the hardware. It facilitates the execution of programs. In order for a program to execute it must be in main memory (at least partially) together with the data that it accesses.

In order to improve the CPU utilization and the speed of response to users, the computer must keep several processes in memory. The available memory in a computer system is limited and cannot accommodate all the programs and data at once. The system must therefore manage the available memory to facilitate the allocation of the programs to memory so that they can be executed in a timely manner. Many memory management schemes exist that reflect various approaches.

In this project we are going to implement a dynamic memory allocation scheme using the best fit strategy. In this scheme processes are put into an input queue as they enter the system. The system takes into account the memory requirements of each process and the amount of available memory space to determine which processes are allocated memory. When a process terminates, it releases its memory, which is then added to the blocks of available memory. If this newly released free block is beside an existing free block, then the two blocks are merged into a single block. For the scheduling of processes we will use the shortest job first scheduling algorithm.

Your implementation should keep track of the following information on the processes and available memory:

Processes currently in memory

List of allocated memory partition

List of free memory partition

List of processes waiting to be allocated memory

List of terminated processes

List of merged partitions

The input to the system should provide facility to read the data from a file as well as to enter the data directly into the system. In both cases the data entered must be stored in a file which can be displayed by the user.

The following information on each process should be included in the Process Control Block (PCB):

ID, Burst Time, Arrival Time = 0, Size, Start Time, End Time, Memory Address (Start and End), Status.

The jobs will be submitted in batches and will first be allocated to memory using the first fit strategy before being assigned to the CPU until termination. We will assume that all jobs arrived at the same time.

The following information should be kept on memory:

List of free partitions (Size, Start address, end address for each partition in the list).

List of allocated partitions (Size, start address, end address, job assigned for each partition in the list) You are required to implement the project with the following functionalities:

  1. Input to the system should provide the user with the option of using a text file or to enter the data directly into the system. The data to be supplied to the system comprises the total memory, memory assigned to the Kernel, number of processes, the process id, the size of the process and the arrival time. The OS should be loaded into low memory.
  2. Assign a process to the best available partition.
  3. Keep a list of the free partitions (initially consisting of a single partition)
  4. Keep a list of the allocated partitions.
  5. Each time a job terminates the system should display the lists for the free partitions and the occupied memory partitions.
  6. When two free memory partitions are adjacent they should be merged and the information for the two partitions and the merged partition displayed.
  7. Display a summary of free partitions, allocated partitions and total memory, number of jobs allocated, and the number of jobs waiting to be allocated.

Submission:

The project should be done in your practical groups with NO MORE than four (4) students per group. Presentations will take place in the practical sessions. The lecturer for the practical will specify how to submit reports and results. All reports MUST show the name, ID number, as well as the tutor’s name.

Include a breakdown of the tasks carried out by each member of the group.

The mark scheme is as follows:

Tasks

Marks

Input using text file and interactive

10

Output to file

5

Implementation

Allocation of process

Sorted lists of partitions

Execution

Accepting input from file and interactively

Saving of reports and input

Display of memory reports

5

5

10

5

5

Total

45

Late submission: 10% per day. After three days will not be accepted

Test Data: you may use the following as test data for your input file:

DATA

Number of processes = 8,Memory size = 180

Process ID

Size

Burst Time

1

15

20

2

40

22

3

5

8

4

20

15

5

30

25

6

12

18

7

8

10

8

45

30

Your data file should look like this:

8,180

1,15,20

2,40,22

3,5,8

4,20,15

5,30,25

6,12,18

7,8,10

8,45,30