microsoft / verona-rt

The runtime for the Verona project
MIT License
25 stars 14 forks source link

Refactor Schedule Many #49

Open mjp41 opened 1 month ago

mjp41 commented 1 month ago

The code in schedule many has been extended by two features:

Both of these lead to some complexity, and the schedule_many code now does a lot of work. It was originally factored into two phases

This effectively replicates the 2PL of enqueue that occurs. However, now in the acquire phase there is a lot of work, and that both complicates the readability, and potentially makes the time taken in the 2PL longer reducing potential throughput.

I propose we split the schedule_many into four phases

I believe this factoring will help with both readability and performance as it moves work before or after the critical acquire/release phases reducing the time spent blocking other scheduler threads.

I believe this factoring would make it easier to address missing features interaction between the two PRs mentioned above.

@vishalgupta97 @marioskogias as you have both recently touched/reviewed this code. Do you have any thoughts on if this refactoring makes sense to you?

mjp41 commented 1 month ago

After discussing with @marioskogias, we should probably call the last phase, "resolve phase".

vishalgupta97 commented 4 weeks ago

Yeah, the refactoring looks good. Small points: