Operating System Processes: 2nd Grade Telecom

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What is the primary function of the operating system regarding processes?

  • To manage and control process execution. (correct)
  • To browse the internet.
  • To create documents.
  • To execute a single program.

Which data structure is used by the Operating System to manage processes?

  • File Table
  • Process Table also known as Process Control Block (PKB) (correct)
  • Memory Map
  • I/O Table

What kind of information is stored within a Process Control Block (PKB)?

  • List of installed software.
  • Memory segments, process state, program registers, and open files. (correct)
  • Only open files and network connections.
  • Only PID and PPID.

What does the 'Program Status Word' (PSW) contain?

<p>Processor status information, such as interrupt enable/disable and flags (C)</p> Signup and view all the answers

What is the key difference between a process and a thread?

<p>Threads share memory space, while processes have separate spaces. (B)</p> Signup and view all the answers

What role does the 'scheduler' play in process management?

<p>It decides which process should run next. (C)</p> Signup and view all the answers

What role does the 'dispatcher' play in process management?

<p>It puts into execution the process selected by the scheduler. (D)</p> Signup and view all the answers

Which event triggers a 'context switch'?

<p>When an interrupt occurs (B)</p> Signup and view all the answers

What is the correct sequence of actions for process creation using the fork() system call?

<p>The new process is an exact copy of the parent, but with a new PID. (A)</p> Signup and view all the answers

After a fork() call, What return value can the child process expect?

<p>Child process receives 0 (D)</p> Signup and view all the answers

What is the primary purpose of the exec() system call?

<p>Replace the current process image with a new program. (B)</p> Signup and view all the answers

If a parent process terminates before its child process, what happens to the child process?

<p>The child process is adopted by the init process. (C)</p> Signup and view all the answers

What is a "zombie" process?

<p>A process that has completed, but whose parent hasn't yet collected its status (B)</p> Signup and view all the answers

Which problem does multithreading aim to solve?

<p>Speed up the execution and reduce the load on the system. (D)</p> Signup and view all the answers

Which variable/resource do threads in the same process share?

<p>Heap Memory segments. (A)</p> Signup and view all the answers

In multithreading, what is a 'race condition'?

<p>When threads compete to access shared resources, leading to errors (D)</p> Signup and view all the answers

What is the purpose of mutex locks in multithreading?

<p>To control access to shared resources, preventing race conditions (B)</p> Signup and view all the answers

How can process or thread parallelism be achieved?

<p>Using multiple cores or processors (C)</p> Signup and view all the answers

In the context of concurrency, what does 'mutual exclusion' ensure?

<p>That only one process can access a shared resource at any given time (C)</p> Signup and view all the answers

What is the purpose of Inter-Process Communication (IPC)?

<p>It enables processes to exchange data and synchronize execution. (C)</p> Signup and view all the answers

What is a 'critical section' in concurrent programming?

<p>A section of code that accesses shard resources. (C)</p> Signup and view all the answers

What are the four conditions that a solution must fulfill to be considered a correct solution to the critical section problem?

<p>Mutual exclusion, progress, bounded waiting and architecture-independence (D)</p> Signup and view all the answers

What is the main idea behind disabling interrupts as a method of providing mutual exclusion?

<p>To prevent tasks from switching while the shared resource is being accessed. (C)</p> Signup and view all the answers

What is a disadvantage of lock variables?

<p>They implement busy waiting. (A)</p> Signup and view all the answers

What is a key feature of the 'Test and Set Lock' (TSL) instruction?

<p>It performs its operations atomically. (C)</p> Signup and view all the answers

What is the goal of implementing passive waiting?

<p>To allow processes to wait without consuming CPU resources. (D)</p> Signup and view all the answers

What is the role of semaphores in process synchronization?

<p>They offer a mechanism to manage concurrent access to shared resources (B)</p> Signup and view all the answers

Which of the following is a typical usage of Semaphores?

<p>Managing access to shared resources (D)</p> Signup and view all the answers

What problems are guaranteed to never happen with a correct implementation of monitors?

<p>Race Conditions and Mutual Exclusion violation (A)</p> Signup and view all the answers

What is a message queue used for?

<p>To allow synchronization by transferring data between processes. (C)</p> Signup and view all the answers

What synchronization problem is illustrated by the Dining Philosophers problem?

<p>Deadlock. (B)</p> Signup and view all the answers

What's the difference between named and unnamed Pipes?

<p>Unnamed pipes can only be used by related processes. (A)</p> Signup and view all the answers

How many syscalls are needed to create a Bi-Directional communication lane between two processes?

<p>Two unnamed (normal) pipes. (C)</p> Signup and view all the answers

What is the correct way of connecting the output of one command to another command as input in the shell?

<p>Unnamed Pipes (B)</p> Signup and view all the answers

What are signals used for?

<p>To Signal Abnormal Situations or events (A)</p> Signup and view all the answers

Which is the correct abstraction for signaling a process from another process?

<p>Signals (C)</p> Signup and view all the answers

What can be said about these two syscalls? kill() and pause()

<p>They allow simulating Mutex primitives. (C)</p> Signup and view all the answers

How can a process specify a handler for a specific signal?

<p>By associating the signal with a custom function via the <code>signal()</code> function (B)</p> Signup and view all the answers

Which of the following is MOST accurate about OS process scheduling?

<p>A process scheduler must decide the order in which the ready processes will be executed (C)</p> Signup and view all the answers

What is the main goal of the scheduler?

<p>Schedule the tasks to maximize productivity. (D)</p> Signup and view all the answers

What is a drawback of Round Robin scheduling?

<p>Always chooses the processes without considering the context. Making it context-switching heavy. (A)</p> Signup and view all the answers

A Round Robin scheduling has its time slice set. What happens if the quantum expires?

<p>The context is swapped to the next process on Queue (B)</p> Signup and view all the answers

Which can be said about processes scheduled with static priorities?

<p>Easy to implement (C)</p> Signup and view all the answers

Which algorithm will most likely avoid starvation given the appropriate setting?

<p>Round Robin (D)</p> Signup and view all the answers

What is the main challenge in real-time scheduling?

<p>Meeting deadlines. (B)</p> Signup and view all the answers

Flashcards

What is a process?

A program in execution, managed by the OS

What is a Process Control Block?

A data structure containing information about a process.

What does proccessor state refer to?

The current state of the process and processor.

What is proccess Identification?

Info like PID and user IDs

Signup and view all the flashcards

What is Threads?

Processes share same set of resources.

Signup and view all the flashcards

What is the intention of Mutex?

Used to prevent issues with shared memory access.

Signup and view all the flashcards

What is the Race condition?

A situation where multiple processes could cause conflicts.

Signup and view all the flashcards

What is Critical section?

A section of code that needs exclusive access.

Signup and view all the flashcards

What is mutual exclusion?

Prevents simultaneous access to shared resources.

Signup and view all the flashcards

active waiting

Technique to avoid waiting.

Signup and view all the flashcards

What is interprocess communication?

Mechanism for processes to communicate and sync.

Signup and view all the flashcards

passive waiting

Processes wait instead of actively polling.

Signup and view all the flashcards

What does Wait() method do?

Blocks until a condition is met.

Signup and view all the flashcards

What does Signal method do?

Signals/resumes a waiting process.

Signup and view all the flashcards

How is Mutual exclusion implemented?

Semafore is used to implement it.

Signup and view all the flashcards

What does deadlock means?

Where each filosofer keeps waiting for different forks.

Signup and view all the flashcards

Why are there Proccess schedulers?

Processes are given priority for resources.

Signup and view all the flashcards

How do Proccess schedulers function?

System performs an algorithm that determines the order to complete tasks.

Signup and view all the flashcards

How should an algorithm be?

Short and easy.

Signup and view all the flashcards

What's the function of a Queue?

First in,First out.

Signup and view all the flashcards

Benefit of queues?

Easy but limited.

Signup and view all the flashcards

Study Notes

  • These are study notes on operating system processes as taught in the 2nd grade of Telecommunications Technology Engineering

Block 1: Operating Systems

  • Explores key computer architecture concepts.
  • Covers operating systems, processes, memory management, and file systems

Contents Covered

  • Introduces operating systems, processes, and threads
  • Communication and synchronization mechanisms
  • Scheduling algorithms
  • Memory and file management

Processes

  • Programs in execution are considered processes; these are processing units managed by the operating system.

Topics in the Processes Section

  • Process creation
  • Process intercommunication
  • Synchronization
  • Scheduling
  • Algorithm mechanism coverage
  • Passive wait implementation.

Program vs Process

  • A program represents a recipe, while a process represents that recipe in action.
  • A process is a unit of processing managed by the OS

Process Table and PCB

  • OS maintains a data structure that relies on Processes and Control Blocks
  • Segments of the memory image include C+D+S.
  • The state of the processor
  • File descriptors already opened, PID, user id, and timers.

Process State and CPU

  • When a process is running, its state resides in the CPU.
  • It exists in the Processes Table's PCB when not running

PCB Information

  • Includes identification details like PID, PPID, and user/group IDs.
  • Processor State: This captures the process's state.
    • This includes CPU registers like PSW, user/kernel mode, interrupt status, priority, and results.
  • Includes PC and SP
  • Control State
    • Scheduling for ready and blocked processes
    • Inter-process communications
    • Signals for timing
  • Information on CPU time, memory

Memory Table Management

  • Controls what memory is allocated to the process
  • Includes segment information
    • CS: base address and code amount
    • DS: data variables and static data
    • SS: starting address
    • Permissions
    • Table for memory pages
    • Dynamic Memory Pointer
    • Information on shared memory being used.

I/O Table

  • Allocates peripherals and I/O operations.

File Table

  • It provides the position in the FILP.
  • Info about the directories used
  • Access permissions

Example PCB framework from MINIX 1.0

  • Example
    • extern struct proc
      • Process registers
        • int p_reg[NR_REGS];
      • Stack pointer
        • int *p_sp;
      • PC and PSW
        • struct pc_psw p_pcpsw;
      • Memory Map
        • struct mem_map p_map[NR_SEGS];
      • Process id - int p_pid;

Basic States of Process

  • Execution
  • Blocked
  • Ready to be executed

Planner Responsibility

  • The scheduler chooses the next process to run
  • Idle loop for when all processes are idle
    • Keeps CPU going
    • Necessary, prevent errors
    • Saves energy
  • Calculate CPU usage
  • Basic function for managing memory

Processes are Heirarchical

  • Parents, Children, and siblings
  • Follow processing life cycle

Life Cycle Includes

  • Create
  • Execute
  • Shutdown
  • Has a set of execution types
    • Batch
    • Interactive

Process Management

  • PGID
  • SID

Processes Inherit information

  • Gets variable from creation
  • Can use and change values that effect parent and siblings
  • IZEN-BALIO table at execution start.
    • int main(int argc, char **argv, char **envp);

Process Setting

  • Defaults to parents
  • Set via shell command or via API
  • Variables are PATH, TERM,HOME, PWD, USER
  • Access via command echo $aldagaia and c code getenv("aldagaia")

Multitasking

  • Single-tasking does nothing while waiting for Input / output
  • CPU Input / Output and parallelism
    • Input / Output system depends on OS.
    • Memory needed to save several states
  • Used to increase performance

Multi-tasking Implementation

  • Processes Input / Outputs are dependent on the OS, this lets the CPU access a new task
  • Provides better performance
  • Allows multiple interactive users
  • Makes it easier to work on applications that should use multiple threads

Types of Computers

  • Multiprogamming via time slicing illusion of concurrency
  • Multi-Processor is true concurrency
  • Multi-Computer works together (processing is distributed)

Concurrency Purpose

  • More usage better of physical resources
  • Modular processing increases work force
  • Interaction is optimized

Types of Concurrent Processing

  • Colleagues
  • Independents

Kinds of Interaction

  • Share processing power
  • Communicate and sync, colleagues

How to handle paralellism and I/O

  • I/O devices get interrupts
  • An interrupt is addressed by the corresponding memory map.
  • OS uses I/O controller for processes to resume from the ready queue

Context Switching

  • Caused by interrupt
  • Processes' state goes into the PCB
  • Interrupt routine executes code
  • Scheduler works
  • Dispatcher initiates execution depending on the OS scheduler routine

Process Loading

  • Executable binary loads into main memory image and the process executes

Process Creation

  • Achieved via "fork"
    • Clones a process including the code and information
  • The child can be run and modified without disturbing the parent.

Execution Modification

  • Can be achieved via "exec"
    • Has two phases
      • HUSTE removes current memory allocation
      • KARGA builds the state of a process
  • Must keep PID, I/O

Process Timing

  • Timing issues of process can be fixed
  • A process must wait till the prior exits before starting.

A-Semen life Cycle

  • Semeek is a copy and executes
  • The atia takes up after the first is done.
  • Can deadlock though

Threads

  • Threads are known as light-weight processes
  • All share an image, execute uniquely
  • Each thread has its own
    • PC
    • Stack Pointer
    • Errors
  • Share files

Pros and Cons of Threads

  • Share memory
  • Shorten time in system
  • Allow lockstep parallel
  • Don't block system easily
  • Easy to delegate tasks
    • Needs synchornized Process sync required for intercommunication

Communication

  • Communication occurs over calls are used for sending and receiving messages
  • Signals, and files are mechanisms
  • Sharing leads to conflicts.

Race conditions

  • Race conditions need to be addressed for process integrity
  • Processes can not simultaneously access critical resources
  • Can be solved with flags

Active vs Passive Waiting

Active Waiting means waiting and polling which requires CPU resources Passive Waiting means waiting on the processes to complete.

Classic Issues

  • Critical section
  • Producer-consuer
  • Irkacle-isles arazoa
  • Bezero-zerbitzaria

Critical Section Review

  • Needs to limit how many process can be in at any given time.
  • There must be a mutual exit.
  • Must finish in a timely manner

TSL and Sets

  • These atomic commands for handling issues of critical process.

Classic IPC problems

  • SE needs to do it
  • They are called PUA and prevent processing overhead

Atomic Transactions

  • Must be done for file or resource security

Production Consumption Review

  • Consumers must wait on products.
  • Produces must wait on consumers to consume.

Read-Write Review

  • Readers consume multiple times while writing must be handled first.

Communication Mechanism

  • Intercommunication requires calls and interfaces
  • File system usage

Methods of Communication

  • Files
  • Hodiak (pipes, FIFOs)
  • Partial image sharing
  • Messages

Synchronized Communication

  • Can be handled via messaging, signals
  • Has several methods
    • Code management
    • Sempahores

File Sharing

  • All processes share files
  • The upside is simple processing
  • The downside has high processing over head needs synchronization.

Pipes

  • Used for temporary or simple code
  • Managed by OS - First In First Out

Named vs unamed pipes

  • Named are FIFO
  • Unmaed are for child/parent only

Datastreams

  • Requires 2 hodis

Pipeline Code Example

  • Requires std io library for operation

Queue Review

  • Code for queue is needed as prior steps can interfere.

Queue Review

  • Uses the pipeline

Seinaleaks

  • Interrupts that are done in short bursts handled.
    • Kill for interrupt

Handling signals and interrupts

  • Can halt signals via code or call another signal interrupt.
    • Pause ()
  • Kill (0 exits code

Handling Events

  • Hardware, and Software trigger signals with code
  • Signal - sends hardware instructions
  • Hardware then sends signals to software
  • Needs treatment for handling signals
  • Called Pause
  • Also can delay response

Process Scheduling

  • Has several factors
  • CPU
  • IO
  • Time

Goal of Process Scheduling

  • Has a variety of goals.
  • CPU usage time, and max throughput

Planning

  • Has a variety of types.

    • Can be more IO, cpu, etc focused. Process scheduling
  • Can be done based on type

  • Has a variety of parameters and configuration.

    • Has priority
      • Static,
      • dynamic
  • All types of plans have different priorities.

  • Lani laburmena

  • Can also be randomized

Planning types

  • Can mix the different types of scheduling.
  • Can also be intermixed for types and kinds of queues Has several methods to prevent deadlock

Time Monitoring

  • Needed to limit certain calls.

Time Sharing

  • Some processes wait, others do not, each is dependent on one another.

Shared Memory Planning

  • Has several levels to maximize performance

Multicore Planning

  • Uses all available cores for increased performance

Resource Assignment

  • Each section of process is resource intensive to a different extent

Load Balancing

  • All different tasks can go to queues

Batch Processing

  • Resources assigned to load balance

Lehentasunak

  • Different types to assign importance

Round Robin

  • Evenly allocates resources Used in network sharing
  • Equal Priority

Prioritized

  • Has priority over others
  • Can be static
  • Can be dynamic

Loteria

  • Random for fairness
  • Uses lotto tickets depending on hardware

Process management

  • Can be done

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

More Like This

Use Quizgecko on...
Browser
Browser