Suggested Exercises 5. Question #1 Find a creative/funny example of synchronization that can demonstrate the difficulty of developing a monitor-based.

Slides:



Advertisements
Similar presentations
Testing Relational Database
Advertisements

Prashant Somashekar. What will we discuss? -Brief overview of a kernel -How a kernel fits into the hierarchy -Android versus Linux kernel -Building an.
UNIX System Programming Installing OpenSolaris. 2/86 Contents How to setup a virtual machine guest How to install OpenSolaris as a guest How to update.
Computer Software 3 Section A Software Basics CHAPTER PARSONS/OJA
CIS238/DL1 Chapter 15 Rebuilding the Linux Kernel Preparing the Source Code Locating the Source Code Installing the Source Code Read the Documentation.
1 Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Homework 6 Sarah Diesburg Operating Systems CS 3430.
Multi-Object Synchronization. Main Points Problems with synchronizing multiple objects Definition of deadlock – Circular waiting for resources Conditions.
1 Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Contiki A Lightweight and Flexible Operating System for Tiny Networked Sensors Presented by: Jeremy Schiff.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization
The Banker’s Algorithm for A Single Resource
Chapter 2.3 : Interprocess Communication
Android Tablet SD Card Update P2 This document is the intellectual property of Acer Inc, and was created for demonstration purposes only.
Operating Systems Lab. (#2) University of Tehran – ECE Dept. Fall 2005 Reza Shokri
Renesas Technology America Inc. 1 M16C/Tiny SKP Tutorial 2 Creating A New Project Using HEW4.
9/8/2015cse synchronization-p1 © Perkins DW Johnson and University of Washington1 Synchronization Part 1 CSE 410, Spring 2008 Computer Systems.
Modifying Network Packet Buffering in Network Layer CS518 Final Presentation and Instruction Guide Li Zhang.
Microsoft Office 2003: Advanced 1 ADVANCED MICROSOFT ACCESS Lesson 17 – Utilizing Advanced Management Tools.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
Lab 11 Department of Computer Science and Information Engineering National Taiwan University Lab11 - Porting 2014/12/9/ 26 1.
Cosc 4740 Chapter 6, Part 3 Process Synchronization.
© 2007 by Prentice Hall 1 Introduction to databases.
09/21/081 Ho Chi Minh city University of Technology Linux kernel R.M. Introduction of building Linux kernel from source.
Chapter Two Exploring the UNIX File System and File Security.
Critical Problem Revisit. Critical Sections Mutual exclusion Only one process can be in the critical section at a time Without mutual exclusion, results.
Intermediate 2 Software Development Process. Software You should already know that any computer system is made up of hardware and software. The term hardware.
Chapter Two Exploring the UNIX File System and File Security.
1 Chapter 2.3 : Interprocess Communication Process concept  Process concept  Process scheduling  Process scheduling  Interprocess communication Interprocess.
Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Concurrency: Mutual Exclusion and Synchronization Chapter 5.
1 Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
An OBSM method for Real Time Embedded Systems Veronica Eyo Sharvari Joshi.
Andy Pavlo November 29, 2015November 29, 2015November 29, 2015 Testing H- Store.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
OS Project 0 February 25, Outline  Linux Installation  Linux Kernel Compilation  System Call Development  Kernel Modules / 452.
Nachos Project 3 Lecturer: Hao-Hua Chu TA: Chun-Po Wang (Artoo) Date: 2008/10/25.
COSC 3407: Operating Systems Lecture 9: Readers-Writers and Language Support for Synchronization.
LOGO Linux Installation. Linux Distribution Including shells, libraries, tools, compiler, servers, applications. Redhat, Fedora, Mandrake, SuSE, Debian,
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
1 Previous Lecture Overview  semaphores provide the first high-level synchronization abstraction that is possible to implement efficiently in OS. This.
Linux Operation System Computer Operation Manual.
© Dr. A. Williams, Fall Present Software Quality Assurance – Clover Lab 1 Tutorial / lab 2: Code instrumentation Goals of this session: 1.Create.
1 Setup and Compile Linux Kernel Speaker: Yi-Ji Jheng Date:
Spring 2007 Vmware and Linux kernel COMS W4118 Columbia University.
Bootstrap Tutorial Overview Objective Learn how to use the bootstrap for configuring the system. Requirements Installed Version of.
Rebuilding Linux Kernel Dedicated to penguin lovers everywhere 26 September 20161Rebuilding kernel by Visakh M R.
Linux Administration – Finding You Way on the Command Line The Linux File Directory or Tree.
6.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles 6.5 Semaphore Less complicated than the hardware-based solutions Semaphore S – integer.
Operating System Kernel Compilation
CS703 - Advanced Operating Systems
Suggested Exercises 5.
Midterm Review David Ferry, Chris Gill
IM-pack: Software Installation Using Disk Images
linux and related thing
Monitors, Condition Variables, and Readers-Writers
Operating System Kernel Compilation
Concurrency: Mutual Exclusion and Synchronization
Kernel Synchronization II
Lesson Objectives Aims Understand how machine code is generated
IS3440 Linux Security Unit 7 Securing the Linux Kernel
Review and Q/A.
Semaphore Originally called P() and V() wait (S) { while S <= 0
COP 4343 Unix System Administration
CS703 - Advanced Operating Systems
Value of Office.
Homework 4.
Linux Operation System
Operating System Kernel Compilation
Presentation transcript:

Suggested Exercises 5

Question #1 Find a creative/funny example of synchronization that can demonstrate the difficulty of developing a monitor-based solution (in pseudocode) similar to the “Readers-Writers.” Make sure that you vigorously discuss the correctness and pitfalls of your solution.

Gas Station Problem There is a common price for gas – Consumers never modify the price – they just pump gas – Owners read modify the price We want one owner at a time, but many consumers at the same time

Developing the Solution Global states: activeConsumers = 0; activeOwners = 0; waitingConsumers = 0; waitingOwners = 0; Condition okToPump = NULL; Condition okToChangePrice = NULL; Lock lock = FREE;

Sample Code Solution – up to you to prove correctness Consumer() { lock.Acquire(); while (activeOwners > 0 || waitingOwners > 0) { ++waitingConsumers; okToPump.Wait(&lock); --waitingConsumers; } ++activeConsumers; lock.Release(); // access price and pumps lock.Acquire(); --activeConsumers; if (activeConsumers == 0 && waitingOwners > 0) { okToChangePrice.Signal(&lock); } lock.Release(); } Writer() { lock.Acquire(); while (activeOwners > 0 || activeConsumers > 0) { ++waitingOwners; okToChangePrice.Wait(&lock); --waitingOwners; } ++activeOwners; lock.Release(); // access database lock.Acquire(); --activeOwners; if (waitingOwners > 0) { okToChangePrice.Signal(&lock); } else if (waitingConsumers > 0) { okToPump.Broadcast(&lock); } lock.Release(); }

Question #2 Find a creative/funny example of deadlock, and apply various deadlock prevention approaches to the live example. Describe the advantages and disadvantages of each approach.

A Tale of Two Fisherman Two fisherman are out fishing, but between them they only have one fishing pole and one bait. – If one takes the pole, and the other takes the bait… They deadlock!

Solutions 1.Infinite resources – Buy more poles and bait 2.No sharing – They each have their own poles and bait, fish alone 3.Allocate all resources at the beginning – They each either get both things or none

Solutions 3.Allocate all resources at the beginning – They each either get both things or none semaphore pole= 1 semaphore bait= 1 lock = 1; fisher(int j) { while (TRUE) { P(s); P(pole); P(bait); // fish V(bait); V(pole); V(s); }

Solutions 4.Make everyone use the same ordering – Fisherman 1 goes first, then fisherman 2 (round robin)

Question #3 Please summarize the steps to configuring, compiling, and installing a kernel and its modules. Include the step of rebooting into the new kernel.

Kernel Steps Configuring a kernel – Download kernel source – Build new configuration from old configuration Copy old configuration into kernel source Issue ‘make oldconfig’ – Customize your kernel Issue ‘make menuconfig’ and select/de-select options as you see fit

Kernel Steps Compiling a kernel – cd into kernel source, type ‘make’

Kernel Steps Installing a kernel – cd into kernel source – Issue ‘make modules_install’ to copy the modules to installation location for new kernel – Issue ‘make install’ to install the kernel executable to /boot – Make an initrd image Issue ‘makeinitramfs –o [output file] [kernel version] – Update the boot loader Issue ‘update-grub’, make sure grub finds both kernel image and initrd image Reboot!