/6.824

A personal implementation of MIT 6.824.

Primary LanguageGo

6.824

A personal implementation of MIT 6.824.

environment

WSL2 + Ubuntu20.04 + Go1.19.4

Lab1

Key points

Implementation

  • Mind the shared data structure,they had better to be currency protected.
  • Use sync.cond to control the execute phase.
  • Use chan to produce and consume tasks.
  • Use goroutine to follow each task's state as soon as it is consumed.(By Sleeping 10s and then wake up to check.)

Testing(passed all tests)

  • command "wait - n" seems does not exist on centos 7,use the following command to replace it in "early exists test".
 while [ ! -e $DF ]
  do
    sleep 0.2
  done

Lab2A

Key points

Debugging

  • It's proved that the clear log can truely make debugging process much easier.I built a debug util under the guidance.

Implementation

  • Be sure that election timeout is random enough.(Don't use time.Now() as a random seed,it's proved to be an awful choice when several nodes reset the election timeout at the same time).

Testing(passed 3000/3000)