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

Assignment 10, 11 Synchronization; atomic operations and linked list with synchronization, vm.dirty_ratio Test #7

Merged
merged 38 commits into from
Jan 6, 2024

Conversation

jimin-kiim
Copy link
Owner

@jimin-kiim jimin-kiim commented Jan 6, 2024

Assignment 10 - Synchronization; atomic operations and linked list with synchronization

Atomic operations

  • performing atomic operations using atomic instructions in a simple kernel module with four kernel threads.
    • fetch-and-add
    • test-and-set
    • compare-and-swap
  • Each thread should increase the shared resource counter by 1 and print it.

Linked list with synchronization

  • Four kernel thread runs simultaneously.
  • Each kernel thread performs Insert, Search, Delete operations to the global linked list, which is shared by all threads.
  • To protect global linked list from corruption by concurrent access of the threads, single global lock is used.
    • spinlock: the most common lock used in linux kernel
      • simply waits in a loop (spin) while repeatedly checking if the lock is available
      • it doesn't need any context switching
      • busy waiting: when the thread remains active but is not performing a useful task. it can lead to the waste of CPU cycles
      • it's usually used when each thread expects to own a lock for a short time
    • mutex (mutual exclusion): a binary semaphore
      • sleeping lock.
      • mutex / semaphore is usually used when each thread expects to own a lock for a long time or it needs to sleep while holding lock
      • when mutex / semaphore is used, the interrupt is blocked.
    • rw semaphore: a multiple readers and single writer lock mechanism.
      • semaphore cannot be used while holding a spin lock.
  • Each thread performs Insert, Search, Delete for its own data range bound.

Assignment 11 - vm.dirty_ratio Test

  • run Fio test with
    • vm.dirty_ratio = 20 (default)
    • vm.dirty_ratio = 40
    • vm.dirty_ratio = 100
  • dirty ratio: the percentage when the generator starts writeback of dirty pages
  • fio: flexible i/o test. tool for measuring performance

…nlock_module.c by adding new file named linked_list_impl.c
@jimin-kiim jimin-kiim merged commit 0551d2d into main Jan 6, 2024
@jimin-kiim jimin-kiim deleted the assignment-10 branch January 6, 2024 16:04
@jimin-kiim jimin-kiim self-assigned this Jan 10, 2024
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

Successfully merging this pull request may close these issues.

1 participant