The University of Western Australia
CITS2002 Systems Programming
 

Department of Computer Science and Software Engineering

CITS2002 Systems Programming

Project 1 Clarifications

Back to project 1.

This page provides any clarifications, more detailed explanations, big hints, or corrects any errors identified after the project description was released. This page will be updated with responses to any common problems or misunderstandings posted on help2002 or asked in laboratory sessions.

8th September
Some clarifications based on questions asked on the help2002 forum:
  • If two devices with the same data transfer speed (priority) are ready to perform I/O at the same time, the device appearing first in the tracefile will be the one to first use the databus.
  • The I/O events of each process ('within' each process's definition) are guaranteed to appear in the tracefile in order that the requests are made.
  • A process's exit event will always be the last line of a process's definition.
  • The final line of your project, the 'best' line, should report the longest time_quantum resulting in the shortest total_process_completion_time.
1st September
Some clarifications based on questions asked on the help2002 forum:
  • The Ready→Running state transition takes 5 microseconds. This time is "owned" by the operating-system; it is unrelated to any process's execution time.
  • The Running→Running state transition (process remaining on the CPU) takes zero time.
  • All other state transitions take zero time (unrealistic, but makes for an easier project).
  • It takes a blocked process 5 microseconds to acquire the databus. This time is "owned" by the operating-system; it is unrelated to any process's execution time.
  • Processes appear in tracefiles in the same (time) order that they are created (New→Ready).
31st August
27th August
  • We can imagine a close equivalence between the processes defined in a tracefile, and simple C programs. Assume that C has a function named calculate_on_CPU(int usecs) to calculate something for a specified number of microseconds. Then we have:

    
    process  1  200 {             int main(void)  // starts 200usecs after system reboot
      i/o   100  hd    1600       {
      i/o   110  usb2  1600          char data[2000];
      i/o   180  hd    1000          int  fd0 = open("/dev/hd",   O_RDONLY);
      i/o   190  usb2  1000          int  fd1 = open("/dev/usb2", O_WRONLY);
      exit  400
    }                                calculate_on_CPU(100);
                                     read(fd0, data,  1600);
                                     calculate_on_CPU(10);
                                     write(fd1, data, 1600);
    
                                     calculate_on_CPU(70);
                                     read(fd0, data,  1000);
                                     calculate_on_CPU(10);
                                     write(fd1, data, 1000);
    
                                     calculate_on_CPU(210);
                                     exit(0)     // at what time does this occur??
                                  }
    
25th August
  • Suggested steps and rate of progress:
    week-1 - (re)read project description, investigate scheduling in a textbook, understand starting code.
    week-2 - modify code to read and store job-mixes from several tracefiles, print-out your variables/data to verify its storage.
    week-3 - simulate job-mixes that have no I/O calculating the total process completion time, vary time-quantum values, report TQ producing the best(shortest) time.
    week-4 - simulate job-mixes that have I/O, ensure all names and student numbers are in your code, submit it!
  • Suggested test cases to consider (and a sample tracefile for each) -
    - one process, no I/O, process exits even before 1st time quantum expires - tfA
    - one process, no I/O, process executes for several time quanta before it exits - tfB
    - two processes, no I/O, process 1 finishes before process 2 starts - tfC
    - two processes, no I/O, both processes execute for several time quanta each: tfD

    - one process, computes, performs one I/O operation, more computation, then exits: tfE
    - one process, computes and performs I/O, in turn, several times: tfF
    - two processes, one computes and performs I/O, which the other just computes: tfG
    - two processes, both compute and perform several I/O operations, all I/O using the same I/O device: tfH
22nd August
  • In the original version of besttq.c, there was a preprocessor line:
    #define MAX_PROCESS_EVENTS      1000

    Do not use that. Instead use:
    #define MAX_EVENTS_PER_PROCESS  100
21st August
  • Devices will not be added or removed once the system is running.
  • Two constants added to besttq.c :

    #define TIME_CONTEXT_SWITCH     5
    #define TIME_ACQUIRE_BUS        5

Chris McDonald.

Department of Computer Science and Software Engineering

This Page

Written by: Chris.McDonald@uwa.edu.au