diff options
author | Mole Shang <[email protected]> | 2024-02-19 14:10:32 +0800 |
---|---|---|
committer | Mole Shang <[email protected]> | 2024-02-19 14:36:21 +0800 |
commit | d86118fc80267649b4791c8c0c72ebd60edf1ef2 (patch) | |
tree | b792b617b4df80a5803a9c1164d0e3fdfe9cfe31 /answers-thread.txt | |
parent | b20ef9d0210fd7d9403acde1857eed1b9880c0b2 (diff) | |
parent | 0cf897cbe05fd8485162619db4244f4159d0eb52 (diff) | |
download | xv6-labs-d86118fc80267649b4791c8c0c72ebd60edf1ef2.tar.gz xv6-labs-d86118fc80267649b4791c8c0c72ebd60edf1ef2.tar.bz2 xv6-labs-d86118fc80267649b4791c8c0c72ebd60edf1ef2.zip |
Merge branch 'fs' into mmap
Conflicts:
.gitignore
Makefile
conf/lab.mk
kernel/defs.h
user/user.h
Diffstat (limited to 'answers-thread.txt')
-rw-r--r-- | answers-thread.txt | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/answers-thread.txt b/answers-thread.txt new file mode 100644 index 0000000..80dde35 --- /dev/null +++ b/answers-thread.txt @@ -0,0 +1,10 @@ +1. Why are there missing keys with 2 threads, but not with 1 thread? + With 1 thread, the put and insert are always interleaved. + No changes to hash table happen at the same time. + But with 2 threads, there will be race to access the hash table, + and this leads to the missing keys. + +2. Identify a sequence of events with 2 threads that can lead to a key being missing. + Suppose thread No. 1 is running the insert and so does thread No. 2. + They shall both insert a entry. But because they enter the insert function with the same hash table, + they could only insert one key at most, which causes a key being missing. |