kaist-cp / cs431

1.42k stars 137 forks source link

[homework 3] elimination-backoff stack (due 12/23) #30

Closed jeehoonkang closed 4 years ago

jeehoonkang commented 4 years ago

References

jeehoonkang commented 4 years ago

Invariants

Procedures

try_push()

try_pop()

hydium commented 4 years ago

in try_push()

Check if the slot is collided; if so, return. (Don't touch the slot and the push request.)

Why not clean up the slot? A pop should've collided and returned by now, there would be no one to clean it up if the push just returns.

hyunsukimsokcho commented 4 years ago

@hydium A collision implies there is a pop() thread colliding against the push() thread you mentioned. Then, the pop() thread seems to be responsible for cleaning up and freeing the PushReq.

hydium commented 4 years ago

@hyunsukimsokcho But then, how does the push() thread know what happened after waking up? After the pop() thread cleans the slot up, it can be reused by other threads and be in an arbitrary state.

hyunsukimsokcho commented 4 years ago

@hydium I see your point. Maybe pop() thread only frees PushReq and push() thread CAS the tag to 0. Then, whether there is a collision can be known by checking PushReq || tag == 3. (It is not a trivial implication from the provided spec. by prof.)

codingskynet commented 4 years ago

I knew that the dead line is 2019-12-23 21:00:00. But, in "gg.kaist.ac.kr" the dead line is "2019-12-23 09:00:01". Is it wrong or just I know wrong information?

cmpark0126 commented 4 years ago

I knew that the dead line is 2019-12-23 21:00:00. But, in "gg.kaist.ac.kr" the dead line is "2019-12-23 09:00:01". Is it wrong or just I know wrong information?

Don't worry, It means 21:00:01. (9:00:01 PM)

jeehoonkang commented 4 years ago

I uploaded the scores. Grading criteria is as follows.

If you're stack doesn't eliminate at all, I deducted 70%. If your program leaks memory, you'll get partial credits (10pts); if your program crashes, you'll get no credits.