[Fundamental] Infra and OS Flashcards
[OS] Concurrency vs Parallelism
Concurrency is when two or more tasks can start, run, and be completed in overlapping time periods. It doesn’t necessarily mean they’ll ever both be running at the same instant.
Parallelism is when tasks literally run at the same time
[OS] What is a critical zone
It cannot be executed by more than one process at a time. Typically, the critical section accesses a shared resource
[Infra] Reverse Proxy
accepts a request from a client, forwards it to a server that can fulfill it, and returns the server’s response to the client
- blacklist IP
- SSL termination
- response compression
- Clients only see the reverse proxy’s IP, allowing you to scale servers or change their configuration
[Infra] Load Balancer
Just like a proxy, but it has a very specific purpose:
balances inbound requests across a cluster of servers
increasing responsiveness and availability
LRU, Least Connection, Least Response Time, RR
Process and Thread
- process: an instance of a program that is being executed
- Processes need IPC (Inter-process Communication) in order to communicate with each other.
- Multiprocessing allocates separate memory and resources for each process or program.
- thread: unit of execution within a process (many thread in one process)
- thread: separating code into segments
- Multithreading threads belonging to the same process share the same memory and resources as that of the process.
Multithreading
multi thread: can share variables between threads, can run in parallel in multicore processor
- problem: race condition
- solution: mutex lock