Download presentation
Presentation is loading. Please wait.
1
ICS143a 2017 Programming Assignment
Jia Chen May 12, 2017
2
Schedule Overview Setting up programming environment
Part 1. CPU scheduling Part 2. Process synchronization Submission
3
Overview CPU scheduling Process synchronization
First come first serve (10 pts) Shortest job first (15 pts) Priority (15 pts) Round robin (20 pts) Process synchronization Using semaphores 3 tasks (10 pts each) = 30 pts Proper submission (10 pts) Compatible with our grading tool
4
Setting up unix-like environment
Option 1. Installing Ubuntu bit on VirtualBox (Recommended) A virtual box file with Ubuntu bit + java is provided : g Option 2. Installing Ubuntu directly on your computer Option 3. Using openlab.ics.uci.edu (terminal only) Visit if you are interested Option 4. Mac or cygwin+Windows or MinGW+Windows Note: We will grade on Ubuntu bit, if you work on Mac or Windows, it is recommended to test your code on Ubuntu before you submit.
5
Part 1. CPU Scheduling First-come first-served Shortest job first
(FCFSSChedulingAlgorithm.java) Shortest job first (SJFSchedulingAlgorithm.java) Single-queue priority (PrioritySchedulingAlgorithm.java) Round Robin (RoundRobinSchedulingAlgorithm.java) Note : Don’t modify other files, or add any new file
6
Part 1. CPU Scheduling SchedulingAlgorithm.java
7
Part 1. CPU Scheduling BaseSchedulingAlgorithm.java
The method isJobFinished and variable activeJob hlep keeping track of the currently running job and determining whether to preempt it or not BaseSchedulingAlgorithm.java
8
Part 1. CPU Scheduling Process.java provides all the properties you will need to schedule the CPU
9
Part 1. CPU Scheduling First-come first-served (FCFSSchedulingAlgorithm.java) (10 pts) If there is a tie, use PID as the tie-breaker Shortest job first (SJFSchedulingAlgorithm.java) (15 pts) Run the job with the shortest remaining time first Single-queue priority (PrioritySchedulingAlgorithm.java) (15 pts) Run the job with the highest priority first Implement the OptionallyPreemptiveSchedulingAlgorithm interface Preempt currently running process only if it is set to be preemptive
10
Part 1. CPU Scheduling Round Robin (RoundRobinSchedulingAlgorithm.java) (20 pts) Maintain state between each call to getNextJob(int currentTime) Default time quantum is 10, but may use different value for grading Don’t modify the getting/setting methods in skeleton code More details in project description
11
Part 1. CPU Scheduling Compiling Running a single case simulation
Go to directory part1, run make Running a single case simulation
12
Part 1. CPU Scheduling Running single case simulation Output
“wait”, “response”, “turn”
13
Part 2. Process Synchronization with Semaphores
Task 1. Synchro1.java (10 pts) Two processes A, B A is not allowed to start iteration I before B terminates its iteration i-1 Valid: A0, B0, B1, B2, A1, B3, B4, B5, A2, A3, A4, A5 Invalid: A0, B0, B1, B2, A1, A2, A3, A4, B3, B4, B5, A5 Sample test case
14
Part 2. Process Synchronization with Semaphores
Task 2. Synchro2.java (10 pts) Two processes A, B Perform their iterations in lockstep (both iteration 0, then both iteration 1, then so on: a process is not allowed to begin its iteration i before the other terminates its iteration i-1) Valid: A0, B0, B1, A1, B2, A2, A3, B3 Invalid: A0, B0, B1, A1, A2, A3, B2, B3
15
Part 2. Process Synchronization with Semaphores
Task 3. Synchro3.java (10 pts) Three processes A, B, C All processes perform their iteration 0, and then 1, and so on A process is not allowed to begin its iteration i before all the other two processes terminate their iteration i-1 Valid: A0, B0, C0, C1, B1, A1, B2, C2, A2, C3, A3, B3 Invalid: A0, C0, B0, B1, A1, A2, C1, C2, B2, C3, A3, B3
16
Submission Go to student directory, and run ./submit.sh
It creates a submission.zip, rename it to your student ID, e.g zip
17
Test your submission with provided grader
Copy your zip file into directory grader, and run ./run_part1.sh (your_id).zip and ./grade_part1.sh s_ Note: we will use different set of test cases for grading, so passing all the test cases here doesn’t guarantee you will get full credit.
18
Test your submission with provided grader
Run ./grade_part2.sh s_ Note: we will use different set of test cases for grading, so passing all the test cases here doesn’t guarantee you will get full credit.
19
Submit to EEE Don’t forget to submit your zip file to EEE, our script will NOT automatically do that for you
20
Next week -- Midterm Solutions
For further questions on Programming Assignment Piazza TA office hour on Thursday
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.