operating systems
play

Operating Systems Chenyang Lu IoT OS Contiki: open-source, - PowerPoint PPT Presentation

Operating Systems Chenyang Lu IoT OS Contiki: open-source, multi-threaded OS, plain C. Amazon FreeRTOS: open-source FreeRTOS kernel + libraries to securely connect devices to AWS cloud services. Arm Mbed: open-source OS based on an Arm


  1. Operating Systems Chenyang Lu

  2. IoT OS Ø Contiki: open-source, multi-threaded OS, plain C. Ø Amazon FreeRTOS: open-source FreeRTOS kernel + libraries to securely connect devices to AWS cloud services. Ø Arm Mbed: open-source OS based on an Arm Cortex-M microcontroller. Ø Windows 10 IoT Core: Windows 10 optimized for both ARM and x86/x64 devices. Ø Linux Chenyang Lu 2

  3. Amazon FreeRTOS https://aws.amazon.com/freertos Chenyang Lu 3

  4. Linux Ø A Brief History: https://youtu.be/aurDHyL7bTA Chenyang Lu 4

  5. Android Source: http://en.wikipedia.org/ wiki/File:Android- System-Architecture.svg Chenyang Lu 5

  6. Killer App for Real-Time? Ø In 2001, about a year after I joined IBM, I got involved with the Sony-Toshiba-IBM initiative that's leading up to the Sony PlayStation 3 . Of course, game systems have extremely severe real-time requirements . All the gaming systems I have seen recently offer sub-reflex response (and, yes, I do have three teenagers, so I have seen a few video games). Gamers will not put up with jerky response, so one-second response times just will not cut it; milliseconds rather than seconds are required. Ø So we are in the very interesting state where gaming and entertainment are major factors driving the technology. When was the last time you heard someone say, "Hey, I bought a new PC and Excel really runs a lot faster"? Paul McKenney, IBM Linux Technology Center Shrinking slices: Looking at real time for Linux, PowerPC, and Cell Chenyang Lu 6

  7. Basic Functions Ø OS controls resources: q who gets the CPU; q when I/O takes place; q how much memory is allocated; q power management… Ø Application programs run on top of OS services Ø Challenge: manage multiple, concurrent tasks. Chenyang Lu 7

  8. Example: Engine Control Concurrent tasks Ø spark control Ø crankshaft sensing Ø fuel/air mixture Ø oxygen sensor engine controller Chenyang Lu 8

  9. POSIX (Portable Operating System Interface) Ø IEEE standards for application portability between Unix variants. q IEEE 1003.1 defines a Unix-like OS interface. q IEEE 1003.2 defines the shell and utilities q IEEE 1003.4 defines real-time extensions. Ø Supported by many operating systems q Variants of UNIX: Linux, MacOS, AIX, HP-UX, Solaris q Many commercial RTOS Chenyang Lu 9

  10. Process Ø A process is a unique execution of a program. q Several copies of a program may run simultaneously. Ø A process has its own context. q Data in registers, PC, status. q Stored in Process Control Block (PCB) Ø Thread: lightweight process q Threads share memory space in a same process. Ø OS manages processes and threads. Chenyang Lu 10

  11. Context Switch process 1 PC registers process 2 CPU ... memory Chenyang Lu 11

  12. Process States Ø A process can be in one of three states: q executing on the CPU; q ready to run; q waiting for data. executing gets CPU preempted needs data gets data Scheduler ready waiting Chenyang Lu 12

  13. Process Management Ø OS keeps track of: q process priorities; q scheduling state; q process control block. Ø Processes may be created: q statically before system starts; q dynamically during execution. Ø OS controls context switches and what process runs. Chenyang Lu 13

  14. Priority Scheduling Ø Every process has a priority. Ø CPU goes to the ready process with the highest priority. q Fixed vs. dynamic priority q Preemptive vs. non-preemptive Chenyang Lu 14

  15. Preemptive Priority Scheduling Ø Each process has a fixed priority (1 highest); Ø P 1 : priority 1; P 2 : priority 2; P 3 : priority 3. P 3 released P 1 released P 2 released P2 P1 P2 P3 30 60 0 10 20 40 50 time Chenyang Lu 15

  16. Preemptive Priority Scheduling Ø Most common real-time scheduling approach q Real-time POSIX q Real-time priorities in Linux q Most RTOS Ø Not the only possible way q Non-preemptive q Clock-driven scheduling q Reservation-based scheduling Chenyang Lu 16

  17. Semaphores Ø OS primitive for controlling access to critical regions. q Get access to semaphore S with sem_wait(S). q Perform critical region operations. q Release semaphore with sem_post(S). Ø Mutex: only one process can hold a mutex at a time. Chenyang Lu 17

  18. Supervisor Mode Ø The mode in which the OS usually runs. Ø Provide protective barriers between applications and OS. q Prevent applications from corrupting OS data. Ø Can do the following only in the supervisor mode q Access the kernel address space q Execute privileged instructions • Example: Set real-time priority q Access special hardware Ø Careful with memory access when q programs run in supervisor mode q processor has no supervisor mode Chenyang Lu 18

  19. Trap (Software Interrupt) Ø Enter supervisor mode. Ø Make system calls. q Open file, read from network… Ø Example: ARM q Use SWI instruction to enter supervisor mode: SWI CODE_1 q Sets PC to 0x08. q Argument to SWI is passed to supervisor mode code. Chenyang Lu 19

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend