Overall Kernel Module Design

Slides:



Advertisements
Similar presentations
Proposal (More) Flexible RMA Synchronization for MPI-3 Hubert Ritzdorf NEC–IT Research Division
Advertisements

Threads Relation to processes Threads exist as subsets of processes Threads share memory and state information within a process Switching between threads.
Mutual Exclusion By Shiran Mizrahi. Critical Section class Counter { private int value = 1; //counter starts at one public Counter(int c) { //constructor.
Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Chapter 6 (a): Synchronization.
CSE 332: C++ memory management idioms C++ Memory Management Idioms Idioms are reusable design techniques in a language –We’ll look at 4 important ones.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 4: Threads.
Process Concept An operating system executes a variety of programs
A. Frank - P. Weisberg Operating Systems Introduction to Cooperating Processes.
50.003: Elements of Software Construction Week 5 Basics of Threads.
Thread. A basic unit of CPU utilization. It comprises a thread ID, a program counter, a register set, and a stack. It is a single sequential flow of control.
Programming Multi-Core Processors based Embedded Systems A Hands-On Experience on Cavium Octeon based Platforms Lab Exercises.
Linux Processes Travis Willey Jeff Mihalik. What is a process? A process is a program in execution A process includes: –program counter –stack –data section.
Silberschatz, Galvin and Gagne  Operating System Concepts Process Concept An operating system executes a variety of programs:  Batch system.
Programming Logic and Design Fourth Edition, Comprehensive Chapter 8 Arrays.
CSE 451: Operating Systems Winter 2015 Module 5 1 / 2 User-Level Threads & Scheduler Activations Mark Zbikowski 476 Allen Center.
+ Arrays & Random number generator. + Introduction In addition to arrays and structures, C supports creation and manipulation of the following data structures:
Programming Multi-Core Processors based Embedded Systems A Hands-On Experience on Cavium Octeon based Platforms Lab Exercises: Lab 1 (Performance measurement)
Read-Copy-Update Synchronization in the Linux Kernel 1 David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis.
Concurrency in Java MD. ANISUR RAHMAN. slide 2 Concurrency  Multiprogramming  Single processor runs several programs at the same time  Each program.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
GMProf: A Low-Overhead, Fine-Grained Profiling Approach for GPU Programs Mai Zheng, Vignesh T. Ravi, Wenjing Ma, Feng Qin, and Gagan Agrawal Dept. of Computer.
December 1, 2006©2006 Craig Zilles1 Threads & Atomic Operations in Hardware  Previously, we introduced multi-core parallelism & cache coherence —Today.
OPERATING SYSTEM CONCEPT AND PRACTISE
Processes and threads.
PROCESS MANAGEMENT IN MACH
Background on the need for Synchronization
Alex Kogan, Yossi Lev and Victor Luchangco
Lecture 5: Synchronization
Atomic Operations in Hardware
Atomic Operations in Hardware
Parallel Shared Memory
Parallel Shared Memory
Process Creation Processes get created (and destroyed) all the time in a typical computer Some by explicit user command Some by invocation from other running.
Analyzing Games of Chance
Chapter 3: Processes.
C++ Memory Management Idioms
Overview of the Lab 2 Assignment: Linux Scheduler Profiling
Overview of the Lab 3 Assignment: Kernel Module Concurrent Memory Use
Bridget Thomson McInnes 10 October 2003
Semester Review Chris Gill CSE 422S - Operating Systems Organization
CSC369 – tutorial 6: Midterm review
Stack Data Structure, Reverse Polish Notation, Homework 7
Recitation 2: Synchronization, Shared memory, Matrix Transpose
Looping.
Race Conditions Critical Sections Dekker’s Algorithm
Object Oriented Programming COP3330 / CGS5409
EECE.4810/EECE.5730 Operating Systems
Semaphore and Multithreading
Designing Parallel Algorithms (Synchronization)
COP 4600 Operating Systems Spring 2011
Review and Q/A.
Introduction to Database Systems
Arrays in Java What, why and how Copyright Curt Hill.
Operating System Concepts
Chapter 5: CPU Scheduling
Top Half / Bottom Half Processing
Project #3 Threads and Synchronization
Overview of the Lab 2 Assignment: Multicore Real-Time Tasks
Semester Review Brian Kocoloski
Userspace Synchronization
Chris Gill CSE 522S – Advanced Operating Systems
Chapter 2 Processes and Threads 2.1 Processes 2.2 Threads
Process Description and Control
Outline Chapter 2 (cont) Chapter 3: Processes Virtual machines
EECE.4810/EECE.5730 Operating Systems
Chapter 4: Threads.
CSE 451 Section 1/27/2000.
EECE.4810/EECE.5730 Operating Systems
More concurrency issues
Threads and concurrency / Safety
Presentation transcript:

Overall Kernel Module Design init When loaded, module will allocate and initialize memory, spawn threads The threads will “sieve” integer array Barrier synchronize before starting Concurrently crossing out multiples Barrier synchronize when finished Then mark an atomic completion flag When unloaded, module will report results and then clean up Print out remaining prime numbers Print out efficiency statistics Print out timing statistics De-allocate memory work exit CSE 422S – Operating Systems Organization

Arrays and Memory Management numbers (data) 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 counters (metadata) data_array current data_array + upper_bound - 1 ctr_array ctr_array + num_threads Module init() function needs to kmalloc() arrays for numbers and counters Sizes are given by module parameters (minus 1 for the numbers since they start at 2) If first allocation succeeds but second fails, must clean up correctly Module init() function spawns as many threads as were specified Each thread is given a pointer to its own “cross-out” counter (see next slide) Threads are allowed to be migrated by Linux (are not pinned to cores) Module exit() function needs to deallocate memory for arrays If initialization succeeded needs to kfree() arrays for numbers and counters Also may need to kfree() numbers array if second allocation failed (your choice) CSE 422S – Operating Systems Organization

Concurrency and Futile Work Even single threaded sieve may cross out the same number multiple times Doesn’t impact correctness Degrades performance somewhat Concurrency can make this worse Data race for non-prime elements Would have been crossed out earlier in a single-threaded implementation Thread’s entire “job” will duplicate work done by other threads’ jobs In this lab you’ll evaluate this effect, rather than trying to “fix” it Each thread will count its cross-outs Cross-outs in excess of the number of non-primes in the array are futile Offers a good measure of efficiency Will also measure completion times, since parallelism may help reduce them 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 CSE 422S – Operating Systems Organization

CSE 422S – Operating Systems Organization Lab Write-up As you work, again record your observations It’s a good idea to read the entire assignment, and to plan and design a bit before starting to work on it It’s also a good idea to develop and test incrementally Write a cohesive report that analyzes, integrates, and offers explanations for what you observed Run different combinations of upper bounds, #s of threads Think (and write) about what trends emerge initially Run additional experiments as needed to confirm trends CSE 422S – Operating Systems Organization