Free Sample
Concurrent and Parallel Programming CPP Assignment 1
Solution.pdfLearning Outcomes
Please state the programme and related module learning outcomes that this assignment is assessing. 1,2,4, 5,6
Assessment Criteria
Please state the assessment criteria applied to this assignment, such as:
-
Correctness of the work.
-
Presentation, including compliance with the specified file format.
-
Evidence of critical thinking and analysis.
-
Originality, quality and thoroughness of the work.
-
Research correct academic approach.
-
Proper treatment of sources.
-
Demo of code will be in lab, failing to show work in lab receive deduction of 50% of total assignment grade.
Upload the answer as a multiple java file ONLY.
Your task is to simulate of college and classrooms: There are four kinds of threads: students, visitors, monitor and a one Lecturer per classroom. students must wait to enter classroom if class is running, enter, and then sitDown. At some point, the Lecturer enters the classroom. When the Lecturer is in the classroom, no one may enter, and the students may not leave. visitors may leave. Once all students check in, the Lecturer can StartLecture. After some time, the Lecturer leaves and all students can leave.
To make these requirements more specific, let’s give the threads some functions to execute, and put constraints on those functions.
-
students must invoke enter, sitDown, and leave.
-
The Lecturer invokes enter, startLecture and leave.
-
visitors invoke enter, sitDown and leave.
-
While the Lecturer is in the classroom, no one may enter and students may not leave.
-
The Lecturer cannot startLecture until all students who have entered have also sitDown.
-
At any point of time any classroom may have only one lecturer.
-
Classroom capacity should not exceed limit. Visitors are always low in count (less than 5).
-
Add a monitor thread to keep printing the status of each class as follows
Simulate a college with few classrooms
{W201 (capacity 60), W202(capacity 60), W101 (Capacity 20), JS101 Capacity (30)} and
lecturers {Osama, Barry, Faheem, Alex, Aqeel, Waseem} that circulate between classes.
Hints: Lecturer can use a binary semaphore to access classroom so one lecturer in class at any time students and visitors can use counted semaphores to access classroom. You can use locks, barriers, semaphores.
The running of the program should show something like the table below, that is updating every 2 seconds
==================================================================================
ClassroomLecturerInSessionStudentsVisitors
==================================================================================
W201 |
Osama |
True |
50 |
3 |
W202 |
Alex |
True |
55 |
1 |
JS101 |
Faheem |
True |
15 |
0 |
W101 |
False |
|||
W201 |
Waseem |
True |
54 |
5 |
W202 |
Aqeel |
True |
43 |
2 |
W101 |
Osama |
True |
18 |
1 |
JS101 |
Barry |
True |
25 |
2 |
Tired of the boring assignments to be submitted to colleges and universities? MyAssignmentMart.com gives you multiple reasons to trust it with your orders. We employ PhD experts handpicked from prestigious universities over the globe. We cater to quality assignment help, dissertation writing services and online essay help, covering more than 100 academic subjects. We pledge to complete your assignments on time and never compromise when it comes to deadline. Our prices for assignments are the most competitive in the market and make sure the cost suits your budget.
Get Assignment Help Now...!
Subjects We Offer
- Engineering Assignment Help
- MATLAB Assignment Help
- Mechanical Engineering Assignment Help
- Civil Engineering Assignment Help
- Computer Science Assignment Help
- Electrical Engineering Assignment Help
- Electronics Assignment Help
- Economics Assignment Help
- Management Assignment Help
- Do My Assignment
- Cheap Assignment Help
- Programming Assignment Help
- Law Assignment Help
- Assignment Provider
- Finance Assignment Help
- Python Assignment help
- Healthcare Management Assignment Help
- Computer Network Assignment Help
- History Assignment Help
- Industrial Engineering Homework Help
- IT Management Assignment Help
- Nursing Assignment Help
- Operating System Assignment Help
- Statistics Assignment Help
- Material Science Assignment Help
- Mechanical Engineering Homework Help
- University Assignment Help
- Agriculture Engineering Homework Help
- ATHE Courses Assignment Help
- Capital Budgeting Assignment Help
- BTEC Assignment Help
- HND Assignment Help
- Material Science Assignment Help
- Psychology Assignment Help
- Resit Assignment Help
- Computer Architecture Assignment Help
- Data Structure Assignment Help
- Database Assignment Help
- PHP Assignment Help