Overview of the Lab 3 Assignment: Kernel Module Concurrent Memory Use

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.
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.
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.
Kernel Structure and Infrastructure David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis St. Louis, MO
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.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
Processes David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis St. Louis, MO
December 1, 2006©2006 Craig Zilles1 Threads & Atomic Operations in Hardware  Previously, we introduced multi-core parallelism & cache coherence —Today.
Kernel Synchronization David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis St. Louis, MO
C++11 Atomic Types and Memory Model
OPERATING SYSTEM CONCEPT AND PRACTISE
Processes and threads.
Scheduling of Non-Real-Time Tasks in Linux (SCHED_NORMAL/SCHED_OTHER)
E81 CSE 522S Advanced Operating Systems Fall 2016 Course Introduction
PROCESS MANAGEMENT IN MACH
Background on the need for Synchronization
Midterm Review Chris Gill CSE 422S - Operating Systems Organization
Lecture 5: Synchronization
Parallel Shared Memory
Parallel Shared Memory
Linux Pipes and FIFOs David Ferry, Chris Gill
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.
Department of Computer Science and Engineering
Chapter 3: Processes.
C++ Memory Management Idioms
Processes David Ferry, Chris Gill
Overview of the Lab 2 Assignment: Linux Scheduler Profiling
Semester Review Chris Gill CSE 422S - Operating Systems Organization
CSC369 – tutorial 6: Midterm review
Linux Virtual Filesystem
Stack Data Structure, Reverse Polish Notation, Homework 7
Looping.
Race Conditions Critical Sections Dekker’s Algorithm
Kernel Synchronization II
COP 4600 Operating Systems Spring 2011
Review and Q/A.
Introduction to Database Systems
Operating System Concepts
Kernel Structure and Infrastructure
Enforcing Real-Time Behavior I
Overall Kernel Module Design
Top Half / Bottom Half Processing
Testing and Debugging Concurrent Code
Kernel Synchronization I
Overview of the Lab 2 Assignment: Multicore Real-Time Tasks
Midterm Review Brian Kocoloski
Kernel Structure and Infrastructure
Semester Review Brian Kocoloski
Kernel Synchronization II
Scheduling of Regular Tasks in Linux
Userspace Synchronization
Kernel Memory Chris Gill, David Ferry, Brian Kocoloski
Chris Gill CSE 522S – Advanced Operating Systems
Kernel Tracing David Ferry, Chris Gill, Brian Kocoloski
Chapter 2 Processes and Threads 2.1 Processes 2.2 Threads
Outline Chapter 2 (cont) Chapter 3: Processes Virtual machines
Chapter 4: Threads.
CSE 451 Section 1/27/2000.
Processes David Ferry, Chris Gill, Brian Kocoloski
Shared Memory David Ferry, Chris Gill
More concurrency issues
Scheduling of Regular Tasks in Linux
Threads and concurrency / Safety
Presentation transcript:

Overview of the Lab 3 Assignment: Kernel Module Concurrent Memory Use Chris Gill, James Orr CSE 422S - Operating Systems Organization Washington University in St. Louis St. Louis, MO 63143

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