18 - Scheduling (5) & Concurrency (1)OutlineStudying Scheduling AlgorithmsScheduling in LinuxScheduling PracticeConcurrency:Inter-Process CommunicationAnnouncementsReading:Studying Scheduling AlgorithmsHow are scheduling algorithms chosen?Kernel can be compiled with different algorithms.Old default: "Completely Fair Scheduling"Current default: EEVDFExtensible scheduler class5 fully CPU-bound processes created at t = 0Round RobinPriority SchedulingIPC ApproachesMessage PassingShared MemoryFCFSSJF> processing time in minutes> high weight = high priority- Round Robin (assume Q << p)- Priority Scheduling- FCFS (alphabetical order)- SJF (non-preemptive)Determine Average Turnaround Time for thefollowing schedules:Modern applications can be made up of manyprocesses requiring communication & coordination.IPC must tackle:4 common approaches:There are a bunch of ways to do message passing:2 main interfaces:The same questions apply to inter-threadcommunication as well (using shared memory).Approaches:Need to compare performance on expected load.Deterministic Modelingwhen compiled in, can't switch dynamicallyimplementation of Weighted Fair Queuing"Earliest Eligible Virtual Deadline First"sched_ext used to implement custom algorithmsbased on Berkeley Packet FiltersThreads do not provide isolation, which is notalways desirable (security concerns)IPC requires syscalls for communicationhow to pass informationhow to prevent undue interferencehow to sequence access (producer-consumer)work on sub-schedulers is underwayoriginal 1996 research paper:uses concept of lag to select eligible processes,then computes a virtual deadline for EDFlinux history:more reading:fixed interval divided proportionally to threads2016 research paper on its problems:Default from ~2007 ~ 2024Queuing ModelsImplementationWhat is the expected load?Scheduling in LinuxScheduling PracticeInter-Process CommunicationPA 3 instructions still pending a few things.currently due in 2 weeks (same day as midterm)1)2)3)4)MOS 2.5, MOS 2.4.1 - 2.4.3-----------------------Collect behavioral traces to model expected load.Stochastically model expected load.Implement first, distribute, and collect user feedbackSuffers from sampling problem and traces difficult to collectSuffers from representation/accuracy of stochastic modelsSuffers from very slow iteration cycleseurosys16eevdf2023 proposalHuaicheng Li VT 2026 slides2023 article2026 article2024 completion10232514648ABCDEMessage Passing via kernelShared Memory via kernelShared File(s)Signals1.2.3.4.Message PassingShared MemoryShared Fileproc Aproc Aproc Aproc Bproc Bproc Bfilesharedkernelkernelkernelmsgmsgmsgmsg-------POSIX message queues: POSIX shared memory:System V shared memorySystem V message queuesUNIX domain socketsNetwork sockets (UDP, TCP/IP, etc.)PipesPOSIX Example:on Linux, the shared memory shows up as a file in/dev/shm until unlinkedwriter.creader.cmqueue.hAnonymous Pipes:Named Pipes:ls | wc -l$ mkfifo pipe$ ls -l$ cat < pipe$ cat > pipe$ rm pipe# create a named pipe pseudofile# shows file type as `p`# read from named pipe to stdout# write stdin to named pipe# delete the pipesys/mman.h