CSE 466 – Fall 2000 - Introduction - 1 Remainder of Syllabus  Lecture  RTOS  Maestro In Linux  Distributed Control Architecture – distributed state.

Slides:



Advertisements
Similar presentations
Device Drivers. Linux Device Drivers Linux supports three types of hardware device: character, block and network –character devices: R/W without buffering.
Advertisements

A Sample RTOS Presentation 4 Group A4: Sean Hudson, Manasi Kapadia Syeda Taib.
1 Chapter 5 Concurrency: Mutual Exclusion and Synchronization Principals of Concurrency Mutual Exclusion: Hardware Support Semaphores Readers/Writers Problem.
Engineering Open House Need students to demo their players on –Friday 3-4 –Saturday 10-2.
Informationsteknologi Wednesday, September 26, 2007 Computer Systems/Operating Systems - Class 91 Today’s class Mutual exclusion and synchronization 
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
Big Picture Lab 4 Operating Systems Csaba Andras Moritz.
1 Concurrency: Mutual Exclusion and Synchronization Chapter 5.
04/14/2008CSCI 315 Operating Systems Design1 I/O Systems Notice: The slides for this lecture have been largely based on those accompanying the textbook.
OS Fall ’ 02 Introduction Operating Systems Fall 2002.
Concurrency. What is Concurrency Ability to execute two operations at the same time Physical concurrency –multiple processors on the same machine –distributing.
CSE Fall Introduction - 1 What is an Embedded Systems  Its not a desktop system  Fixed or semi-fixed functionality (not user programmable)
OS Spring’03 Introduction Operating Systems Spring 2003.
1 Device Management The von Neumann Architecture System Architecture Device Management Polling Interrupts DMA operating systems.
1 An Architectural View of an OS Inter-process communication Process Scheduling Process Control Subsystem File Subsystem Device Drivers Hardware Control.
CSE 466 – Fall Introduction - 1 Implementation of Shared Memory  Considerations  Network traffic due to create/read/write  Latency of create/read/write.
© 2004, D. J. Foreman 2-1 Concurrency, Processes and Threads.
I/O Tanenbaum, ch. 5 p. 329 – 427 Silberschatz, ch. 13 p
hardware and operating systems basics.
Discussion Week 8 TA: Kyle Dewey. Overview Exams Interrupt priority Direct memory access (DMA) Different kinds of I/O calls Caching What I/O looks like.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
CSE 466 – Fall Introduction - 1 Reentrant Driver open() { if (count++) return(0); else return(grab_resources()); } release() { if (--count) return(0);
CSE466 Autumn ‘00- 1 Music Format if amp = 0, note is a command switch(note) 0: turn off specified channel 1: continue for specified tne w/ no change else.
Operating Systems Lecture 7 OS Potpourri Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of Software.
LINUX System : Lecture 7 Bong-Soo Sohn Lecture notes acknowledgement : The design of UNIX Operating System.
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.
Overview Task State Diagram Task Priority Idle Hook AND Co-Routines
IPC Programming. Process Model Processes can be organized into a parent-child hierarchy. Consider the following example code: /* */
Concurrency & Context Switching Process Control Block What's in it and why? How is it used? Who sees it? 5 State Process Model State Labels. Causes of.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
1 VxWorks 5.4 Group A3: Wafa’ Jaffal Kathryn Bean.
CSE 466 – Fall Introduction - 1 User / Kernel Space Physical Memory mem mapped I/O kernel code user pages user code GPLR virtual kernel C
 Wind River Systems, Inc Chapter - 7 Intertask Communication.
6.0 INTRODUCTION TO REAL-TIME OPERATING SYSTEMS (RTOS) 6.0 Introduction A more complex software architecture is needed to handle multiple tasks, coordination,
Chapter 13: I/O Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 2, 2005 I/O through system calls Protection.
Lecture 12 Page 1 CS 111 Online Using Devices and Their Drivers Practical use issues Achieving good performance in driver use.
Operating Systems CMPSC 473 Signals, Introduction to mutual exclusion September 28, Lecture 9 Instructor: Bhuvan Urgaonkar.
CSE466 - Fall What is an Embedded System  Its not a desktop system  Fixed or semi-fixed functionality (not user programmable)  Lacks some or.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 2: The Linux System Part 3.
More Discussions on hw5 Timer interrupts –called ticks. ISR called tick handler Kernel uses ticks for: –time keeping, incrementing the global system time.
Introduction Contain two or more CPU share common memory and peripherals. Provide greater system throughput. Multiple processor executing simultaneous.
CSCI1600: Embedded and Real Time Software Lecture 17: Concurrent Programming Steven Reiss, Fall 2015.
Operating System Concepts and Techniques Lecture 14 Interprocess communication-3 M. Naghibzadeh Reference M. Naghibzadeh, Operating System Concepts and.
CSE466 Autumn ‘00- 1 Task Diagram music serial music_isr serial_isr OS music time slice…signal music task music time slice os time slice os time slice.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
Big Picture Lab 4 Operating Systems C Andras Moritz
WORKING OF SCHEDULER IN OS
REAL-TIME OPERATING SYSTEMS
Operating Systems Review ENCE 360.
CS 6560: Operating Systems Design
Topics Covered What is Real Time Operating System (RTOS)
Safe Queue? … while (next(head) == tail); // block if full
Protection of System Resources
CSE 466 – Fall Introduction - 1
CSE 466 – Fall Introduction - 1
Process Synchronization and Communication
Operating Systems Chapter 5: Input/Output Management
CS703 - Advanced Operating Systems
Synchronization Issues
Mid Term review CSC345.
Chapter 2: The Linux System Part 3
CSE 451 Autumn 2003 Section 3 October 16.
CSCI1600: Embedded and Real Time Software
Concurrency, Processes and Threads
LINUX System : Lecture 7 Lecture notes acknowledgement : The design of UNIX Operating System.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
CSCI1600: Embedded and Real Time Software
LINUX System : Lecture 6 Bong-Soo Sohn
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

CSE 466 – Fall Introduction - 1 Remainder of Syllabus  Lecture  RTOS  Maestro In Linux  Distributed Control Architecture – distributed state management  Quiz  Embedded Networking  Safety and Society  Real Time UML  Quiz/Final  Lab  This week: streaming demo required…no report  Next week: Two-way pilot-player interface, full “player” UI w/ pause, etc. no resetting of processor for next song! Time to clean up.  I2C network  upgrade?

CSE 466 – Fall Introduction - 2 Linux Interprocess Communication  Semaphore process 1: semid = getsem(semid); semop(semid, -1); // wait process 2: semid = getsem(semid); semop(semid,1); // signal  Pipes (queue) void main() { int pfds[2]; pipe(pfds); if (fork()) producer(); else consumer(); } void producer() { // serial? int q = pfds[0]; while (1) write(q, data, n); } void consumer() { // music? int q = pfds[1]; while (1) read(q, data, n); }

CSE 466 – Fall Introduction - 3 FIFO’s, which are named pipes  Process 1 void main() { mknod(“myfifo”, S_IFIFO, ); // create a FIFO file node f = open(“/usr/larrya/myfifo”, O_WRONLY); write(f, data, n); }  Process 2 void main() { f = open(“/usr/larrya/myfifo”, O_RDONLY); read(f, data, n); }

CSE 466 – Fall Introduction - 4 A Player? void main() { int pfds[2]; pipe(pfds); if (fork()) serial(); else consumer(); } void serialTask() { // serial? int q = pfds[0]; s = open(“/dev/com1”, O_RDWR); while (1) {read(s, data, 1); write(s,ack, 1); write(q, data, 1); } void musicTask() { // music? int q = pfds[1]; while (1) { semop(semid, -1); processNextPacket(read(q, data, n)); } now all we need as an ISR, right?

CSE 466 – Fall Introduction - 5 Not Quite  Not yet  User programs are not allowed to access the physical devices (physical memory space) – including hardware interrupts. Only the OS can do that.  User programs can’t control when things happen  OS slice is about 10ms, maybe 1ms on some machines  If there are many tasks, our musicTask might not meet its deadline..  Need a device driver  Its part of the operating system  It can include an interrupt service routine  What is a device driver?  The interface is the same as a file on the disc  supports standard file I/O interface open() read() write() close()  Driver writer defines these system calls to provide a useful general device to the public

CSE 466 – Fall Introduction - 6 Partition between the User App and The Driver  Device Driver should be general…what would a player look like?  open() – makes sure that hardware resources are available…not being used by another device for example. Registers the interrupt service routine  read() – nothing? can be defined to return current packet?  write() – adds packets to the queue? so, maybe our SERIAL is the user app, and our MUSIC/ISR is the OS/Device Driver. write should fail if it isn’t a proper music packet: three tones and duration.  close() – release the hardware resources  Now…how do we get a good trade-off between interrupt latency and timeliness+  Need an ISR for the tone generation and tone duration counting  Where can we put the housekeeping?  ISR?  device driver?  User App?

CSE 466 – Fall Introduction - 7 Answer: In the ISR…sort of  Linux Nomenclature for Interrupt handling  Top Half – the actual ISR. Time critical stuff  Bottom Half – the Time dependent, less critical stuff. Signaled by the ISR User App ie. stream cse466 format music from serial port to player Top Half: Tone Generation Bottom Half: Housekeeping int Device Driver Interface (open, read, etc.) task queue user space kernel space system call

CSE 466 – Fall Introduction - 8 Schedule of task queues…bottom halves in Linux blah() TOP HALF interrupt BOT. HALF blah() rti OS: Schedule or sys call sys call or tick EXECUTE TASK QUEU blah() add to task queue, and mark execution Device Driver no critical section here BOT HALF and Device Driver are mutually exclusive. Not true for Top Half, so this is a good way to share data between driver and ISR write() myapp other app

CSE 466 – Fall Introduction - 9 As a Task Diagram process 2 process 1 myapp OS/other OS/driver ISR BOT ISR TOP myapp: write(player…) myapp: blocked by driver on full queue ISR BOT and Driver are mutually exclusive, so no problem with shared data structure.

CSE 466 – Fall Introduction - 10 The Application void main() { if (serial = open("/dev/com3", O_RDWR) == -1) exit(); // open serial port if (player = open("/dev/player", O_RDWR) == -1) exit(); // open player device while (1) { read(serial, &byte, 1); // blocking read write(serial, &ack, 1); // send acknowledgement switch(state) case STREAMING: read(serial,packet,1); // maybe better if non-blocking ? n = getNumTones(*packet); read(serial, packet+1, n); // read the tone bytes TNE = getTNE(packet); // set new TNE if (isStop(packet)) { close(serial); // close the I/O close(player); // close the player, release the HW resources exit(); } getTones(packet, writeBuf); // convert packet to tones writeBuf[3] = duration; // add duration write(player, writeBuf, 4); // write to the player break; case IDLE: if (byte == 'S') { state = STREAMING; read(serial,&duration,1); // time slice duration...this is a blocking read }