Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggested HW changes #12

Open
agmui opened this issue Feb 1, 2024 · 0 comments
Open

Suggested HW changes #12

agmui opened this issue Feb 1, 2024 · 0 comments

Comments

@agmui
Copy link

agmui commented Feb 1, 2024

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.

for example:

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

typo:

  • misspelled unhappy in .c file and assignment output
    // printf("[Customer %ld] Left unhapy because waiting room is full...\n", tid);

Most common bugs/warnings for condvars basic

  • sleeping while holding lock
  • lock before checking vars in if or while loops

inorder.c:

  • 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.

hen.c:

  • Be clear that animals stay in the kitchen when waiting after complaining for bread
    When the duck, cat, or dog notice that there are no loaves of bread available,
  • There were some submissions where multiple animals ask for bread one after another

Tests that should be added:

hen.c:

  • add test to check if multi animals ask for bread
  • check if once an animal complains it stays in the kitchen

Scheduler hw

This list just contains the most common misconceptions I saw when helping others complete the lab:

  1. Please better emphasize user should be on klist branch. Some people just skip the top part of the lab?

  2. mini btop guide like how to search with f -> arrows keys -> hit enter

    To help you visualize the utilization of the resources on your device, you can

without wfi

image

correct solution:

image

  1. Say to read only ch 7.3 not just ch 7

    to skim [Chapter 7 of the xv6

  2. Clarify that CPUs stand for cores

    - ❓ How does the xv6 kernel handle scheduling on multiple CPUs?

  3. be more explicit with how the casting of list_head to proc* works. Many students missed that section. Like have a mention of this outside of the api demo.

    container = (struct my_data_struct *)iterator;

  4. remove 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

    iterator = iterator->next;

  5. Change the wording of "process control block" to struct many people were confused

    - Add a `struct list_head` to the process control block (make sure that it is

  6. 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.

  7. 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:

  1. 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.

  2. Remind students that they can use procdump for debugging

  3. 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.

  4. Clarify that you only need to run usertests forkforkfork nothing else because some people ran usertests at the end

    ### Testing

typos:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant