Alifyandra's OS202 GitHub Page 🤓

Logo

This page will be regularly updated with weekly top 10 lists and my very own personal log. Stay tuned!

View the Project on GitHub alifyandra/os202

cd ../

Top 10 List of Week 06

  1. What is Concurrency?

    Concurrency is the execution of the multiple instruction sequences at the same time. It happens in the operating system when there are several process threads running in parallel. The running process threads always communicate with each other through shared memory or message passing. Concurrency results in sharing of resources result in problems like deadlocks and resources starvation.

  2. Problems of Concurrency

    • Running of Multiple Apps: Enables the running of multiple Apps.
    • Better Resource Utilization: It enables unused resources to be used by other apps.
    • Better Average Response Time: Apps have to wait for each other without concurrency.
    • Better Performance: Enables a better performance by the OS.
  3. Drawbacks of Concurrency

    • Non-atomic Operations: Non-atomic operations that are interrupted by processes.
    • Starvation: When a process doesn’t obtain service to progress.
    • Deadlock: Two processes are blocked.
  4. Fork() in C

    Fork system call is used for creating a new process, which is called a child process, which runs concurrently with the process that makes the fork() call (parent process). After a new child process is created, both processes will execute the next instruction following the fork() system call. A child process uses the same pc(program counter), same CPU registers, same open files which use in the parent process.

  5. Process Creation in Linux

    When the computer boots up, the kernel (the ‘middle man’ between the operating system and the CPU) loads a program called init (or systemd) into memory and it begins executing; this is the first process.

    From here on, processes are created by duplicating an existing process. This is known as a fork. The fork() system call asks the kernel to essentially copy the existing process and give the new process some space in memory. The original process is now referred to as the parent, and the duplicate becomes the child.

  6. Process Scheduling

    Process scheduling is the activity of the process manager that handles the removal of the running process from the CPU and the selection of another process on the basis of a particular strategy.

    Process scheduling is an essential part of a Multiprogramming operating systems. Such operating systems allow more than one process to be loaded into the executable memory at a time and the loaded process shares the CPU using time multiplexing.

  7. Inter Process Communication

    Inter process communication (IPC) is a mechanism which allows processes to communicate with each other and synchronize their actions. The communication between these processes can be seen as a method of co-operation between them. Processes can communicate with each other through both Shared Memory & Message Passing.

  8. Threads

    A thread is a flow of execution through the process code, with its own program counter that keeps track of which instruction to execute next, system registers which hold its current working variables, and a stack which contains the execution history.

    A thread shares with its peer threads few information like code segment, data segment and open files. When one thread alters a code segment memory item, all other threads see that.

    A thread is also called a lightweight process. Threads provide a way to improve application performance through parallelism. Threads represent a software approach to improving performance of operating system by reducing the overhead thread is equivalent to a classical process.

  9. Multithreading

    Threads are popular way to improve application through parallelism. For example, in a browser, multiple tabs can be different threads. MS word uses multiple threads, one thread to format the text, other thread to process inputs, etc.

    Threads operate faster than processes due to following reasons:

    1) Thread creation is much faster.

    2) Context switching between threads is much faster.

    3) Threads can be terminated easily

    4) Communication between threads is faster.

  10. Concurrency vs Paralellism

    Concurrency means that an application is making progress on more than one task - at the same time or at least seemingly at the same time (concurrently).

    If the computer only has one CPU the application may not make progress on more than one task at exactly the same time, but more than one task is in progress at a time inside the application. To make progress on more than one task concurrently the CPU switches between the different tasks during execution.

    The term parallelism means that an application splits its tasks up into smaller subtasks which can be processed in parallel, for instance on multiple CPUs at the exact same time. Thus, parallelism does not refer to the same execution model as parallel concurrent execution - even if they may look similar on the surface.

    To achieve true parallelism your application must have more than one thread running - and each thread must run on separate CPUs / CPU cores / graphics card GPU cores or similar.

cd ../