Univeristy of Nizwa
College of Economics, Management and Information Systems / / Dr. Tarek Guesmi
Semester : Spring 2012
Worth 5
Due Date:
Assignment 1
COMPUTER SYSTEMS CONCEPTS (INFS-522)

NAME...... …...... ID...... SIGN......

Exercise 1

Assume that you have the following processes all arriving at time 0:

For each of the following CPU scheduling algorithms:

·  First Come First Serve

·  Shortest Job First

·  Non-Preemptive Priority Scheduling

·  Round Robin (assume a quantum of 1ms)

1.  Draw the Gantt graph of the processes execution.

2.  Determine the turnaround (finishing time minus arrival time) and wait times for each process as well as the average wait and turnaround times.

Exercise 2

Consider a logical address space of eight pages of 1024 words each, mapped onto a physical memory of 32 frames.

·  How many bits are there in the logical address?

·  How many bits are there in the physical address?

Exercise 3

Consider the following C program:

1-#include <stdio.h>
2-#include <stdlib.h>
3-main()
4-{
5- char ch, source_file[20], target_file[20];
6- FILE *source, *target;
7-
8- printf("Enter name of file to copy\n");
9- gets(source_file);
10-
11- source = fopen(source_file, "r");
12-
13- if( source == NULL )
14- {
15- printf("Press any key to exit...\n");
16- exit(EXIT_FAILURE);
17- }
18-
19- printf("Enter name of target file\n");
20- gets(target_file);
21-
22- target = fopen(target_file, "w");
23-
24- if( target == NULL )
25- {
26- fclose(source);
27- printf("Press any key to exit...\n");
28- exit(EXIT_FAILURE);
29- }
30-
31- while( ( ch = fgetc(source) ) != EOF )
32- fputc(ch, target);
33-
34- printf("File copied successfully.\n");
35-
36- fclose(source);
37- fclose(target);
38-
39- return 0;
40-
41- }

1.  What is the purpose of system calls?

2.  Enumerate the system calls that are embedded in the above C program. For each system call, indicate the associated instruction (line number)?