Car (1) entered tunnel in EW direction...
Car (2) entered tunnel in EW direction...
Car (3) entered tunnel in EW direction...
Car (16) entered tunnel in WE direction...
Ambulance 31 waiting to enterer the tunnel in WE direction
Car (4) waiting to enter tunnel in EW direction...
Car (16) exited tunnel in WE direction...
Ambulance 31 entered the tunnel in WE direction
Car (2) exited tunnel in EW direction...
Car (1) exited tunnel in EW direction...
Car (3) exited tunnel in EW direction...
Ambulance 31 exited the tunnel in WE direction
people forget they should have used broadcast instead of signal.
If the threads came in reverse order (4,3,2,1) it would cause a deadlock
tunnel.c:
There were many times when people forget to let waiting ambulance have priority
Sometimes people did not add an ambulance to the tunnel count and only added it to an ambulances count.
So ambulance has a chance to slip through. For example: EW=2, WE=0, ambulance=3
ewcars and ambulances should be broadcast cuz there is a chance that a lane opens but the car waits.
For example: say only 1 ambulance is in the tunnel and 3 ew cars pull out outside waiting cuz of the ambulance. Then when the ambulance leaves it only signals to one car and the other 2 just wait.
Tests that should be added:
inorder.c:
send threads in reverse order
tunnel.c:
have 2 EW cars go in then send 3 ambulances go in and check if 5 cars somehow end up in the tunnel
Have 1 ambulance go in and have 3 cars wait outside. Then when the ambulance leaves check if all three cars go in.
Condvars 2
There were many cases where people got docked for putting their print statements in the wrong place.
Have it so that the print and sleep statements are wrapped in a function, called critical_section() or something, so to the students
it would seem more important and place it in the correct position. Doing this also will help with the autograder because
sometimes people forget to put in print statements and the autograder would mark it as wrong.
explain what userinit and procinit do or at least say that these functions only run once at the beginning and
students could potently put init code in there.
Have a better pseudo-code explanation of runq.
For example, make this analogy:
There are 4 chefs in the kitchen(harts)
and they get a queue of orders coming in. Each chef takes the first order of
that queue and starts working. Then hint that to add to the queue a proc must be marked RUNNABLE.
Since 2 chefs can't take the same order at the same time they need to lock.
Add hints that there won't be big modifications to most functions(only around 6).
Reminder users how to search in vim (use "/") and to just search RUNNABLE as a hint.
Remind students that they can use procdump for debugging
Remind students that they need to also lock when the scheduler is checking when the queue is empty.
Many people forget and only lock when popping from the queue.
Suggested HW changes
Condvars basic
for tunnel.c please have the students print out if an ambulance or car wants to enter the tunnel. I can add a check to the autograder to see if a car goes in if an ambulance is waiting. https://github.com/RHIT-CSSE/csse332/blob/5e639c2059cafd7fab88cbbd86690970ead15982/labs/condvar/tunnel.c#L53
for example:
typo:
Most common bugs/warnings for condvars basic
inorder.c:
tunnel.c:
Tests that should be added:
inorder.c:
tunnel.c:
Condvars 2
There were many cases where people got docked for putting their print statements in the wrong place. Have it so that the print and sleep statements are wrapped in a function, called
critical_section()
or something, so to the students it would seem more important and place it in the correct position. Doing this also will help with the autograder because sometimes people forget to put in print statements and the autograder would mark it as wrong.hen.c:
Tests that should be added:
hen.c:
Scheduler hw
This list just contains the most common misconceptions I saw when helping others complete the lab:
Please better emphasize user should be on klist branch. Some people just skip the top part of the lab?
mini btop guide like how to search with f -> arrows keys -> hit enter https://github.com/RHIT-CSSE/csse332/blob/5e639c2059cafd7fab88cbbd86690970ead15982/labs/sched/index.md?plain=1#L134
without wfi
correct solution:
Say to read only ch 7.3 not just ch 7 https://github.com/RHIT-CSSE/csse332/blob/5e639c2059cafd7fab88cbbd86690970ead15982/labs/sched/index.md?plain=1#L99
Clarify that CPUs stand for cores https://github.com/RHIT-CSSE/csse332/blob/5e639c2059cafd7fab88cbbd86690970ead15982/labs/sched/index.md?plain=1#L109
be more explicit with how the casting of
list_head
toproc*
works. Many students missed that section. Like have a mention of this outside of the api demo. https://github.com/RHIT-CSSE/csse332/blob/4566802a928388e0d7f113f423f4a0786f6792a0/labs/sched/index.md?plain=1#L252remove the iteration example because it is easier to just pop of the queue This is bc people will implement an iterator when doing the assignment https://github.com/RHIT-CSSE/csse332/blob/5e639c2059cafd7fab88cbbd86690970ead15982/labs/sched/index.md?plain=1#L255
Change the wording of "process control block" to struct many people were confused https://github.com/RHIT-CSSE/csse332/blob/4566802a928388e0d7f113f423f4a0786f6792a0/labs/sched/index.md?plain=1#L272
explain what userinit and procinit do or at least say that these functions only run once at the beginning and students could potently put init code in there.
Have a better pseudo-code explanation of runq.
For example, make this analogy:
There are 4 chefs in the kitchen(harts) and they get a queue of orders coming in. Each chef takes the first order of that queue and starts working. Then hint that to add to the queue a proc must be marked RUNNABLE. Since 2 chefs can't take the same order at the same time they need to lock.
In the end, just communicate these 2 things:
https://github.com/RHIT-CSSE/csse332/blob/5e639c2059cafd7fab88cbbd86690970ead15982/labs/sched/index.md?plain=1#L166
https://github.com/RHIT-CSSE/csse332/blob/4566802a928388e0d7f113f423f4a0786f6792a0/labs/sched/index.md?plain=1#L277
Add hints that there won't be big modifications to most functions(only around 6).
Reminder users how to search in vim (use "/") and to just search RUNNABLE as a hint.
Remind students that they can use procdump for debugging
Remind students that they need to also lock when the scheduler is checking when the queue is empty. Many people forget and only lock when popping from the queue.
Clarify that you only need to run
usertests forkforkfork
nothing else because some people ranusertests
at the end https://github.com/RHIT-CSSE/csse332/blob/5e639c2059cafd7fab88cbbd86690970ead15982/labs/sched/index.md?plain=1#L330typos:
line 437 of proc.c typo "isse" should be issue? https://github.com/rhit-csse332/csse332-labs/blob/22467ef69fc1ef47933b70edd0d2d05a47671b69/xv6-riscv/kernel/proc.c#L437
Misspelled
supports
in synchronization section https://github.com/RHIT-CSSE/csse332/blob/5e639c2059cafd7fab88cbbd86690970ead15982/labs/sched/index.md?plain=1#L298