Skip to content

Instantly share code, notes, and snippets.

@kemingy
Created October 26, 2020 15:59
Show Gist options
  • Select an option

  • Save kemingy/7327c3e7e53de70c0ca1f9ff8a8529c1 to your computer and use it in GitHub Desktop.

Select an option

Save kemingy/7327c3e7e53de70c0ca1f9ff8a8529c1 to your computer and use it in GitHub Desktop.
OS related questions for interview

Synchronization Primitives

Mutex vs Semaphore

  • mutex
    • locking mechanism
    • only the owner can release the lock
    • recursive mutex can be locked more than once (POSIX complaint systems)
  • semaphore
    • signaling mechansim
    • multiple threads can acquire binary semaphore at a time concurrently

Cache

For arithmetic logic units (ALU):

ALU - Registers (7 kB, 1 cycle) - L1 cache (32 kB, > 5 cycles) - L2 cache (512 kB, > 10 cycles) - L3 cache (shared 2 ~ 32 MB, > 30 cycles)

Non-uniform memory access (NUMA)

https://en.wikipedia.org/wiki/Non-uniform_memory_access

Under NUMA, a processor can access its own local memory faster than non-local memory (memory local to another processor or memory shared between processors).

Single instruction, multiple data (SIMD)

https://en.wikipedia.org/wiki/SIMD

It describes computers with multiple processing elements that perform the same operation on multiple data points simultaneously.

AVX-512

https://en.wikipedia.org/wiki/AVX-512

Inter-process communication (IPC)

https://en.wikipedia.org/wiki/Inter-process_communication

  • file
  • signal
  • socket
  • Unix domain socket
  • message queue
  • anonymous pipe
  • named pipe
  • shared memory
  • memory-mapped file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment