l41: advanced operating systems · 2016-10-25 · the os plays a central role in whole-system...

21
L41: Advanced Operating Systems Through tracing, analysis, and experimentation Dr Robert N. M. Watson 25 October 2016 Dr Robert N. M. Watson L41: Advanced Operating Systems 25 October 2016 1 / 21

Upload: others

Post on 10-Mar-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

L41: Advanced Operating SystemsThrough tracing, analysis, and experimentation

Dr Robert N. M. Watson

25 October 2016

Dr Robert N. M. Watson L41: Advanced Operating Systems 25 October 2016 1 / 21

Introduction

Getting started

1. What is an operating system?2. Systems research3. About the module4. Lab reports5. Readings for next time

Dr Robert N. M. Watson L41: Advanced Operating Systems 25 October 2016 2 / 21

What is an operating system?

What is an operating system?

Whiteboarding exercise

Dr Robert N. M. Watson L41: Advanced Operating Systems 25 October 2016 3 / 21

What is an operating system?

What is an operating system?

[An OS is] low-level software that supportsa computer’s basic functions, such as

scheduling tasks and controlling peripherals.- Google hive mind

Dr Robert N. M. Watson L41: Advanced Operating Systems 25 October 2016 4 / 21

What is an operating system?

General-purpose operating systems... are for general-purpose computers

I Servers, workstations, mobile devicesI Run ‘applications’ – i.e., software unknown at design timeI Abstract the hardware, provide ‘class libraries’I E.g., Windows, Mac OS X, Android, iOS, Linux, FreeBSD, ...

Userspace Local and remote shells, management tools, daemonsRun-time linker, system libraries, tracing facilities- - - - system-call interface - - - -

Kernel System calls, hypercalls, remote procedure call (RPC)Processes, filesystems, IPC, sockets, managementDrivers, packets/blocks, protocols, tracing, virtualisationVM, malloc, linker, scheduler, threads, timers, tasks, locks

Continuing disagreement on whether distributed-filesystem serversand window systems ‘belong’ in userspace or the kernel

Dr Robert N. M. Watson L41: Advanced Operating Systems 25 October 2016 5 / 21

What is an operating system?

Other kinds of operating systems

What if we specialise the OS for specific applications or environments?

I Embedded operating systemsI Serve a single application in a specific contextI Wireless access points, medical devices, washing machines, carsI Small code footprint, real-time schedulingI Might have virtual memory / process modelI Microkernels or single-address space: VxWorks, RTEMS, L4I Now also: Linux, BSD over a real-time kernel

I Appliance operating systemsI Apply embedded model to higher-level devices/applicationsI File storage appliances, routers, firewalls, ...I E.g., Juniper JunOS, Cisco IOS, NetApp OnTap, EMC/IsilonI Under the hood, almost always Linux, BSD, etc

Dr Robert N. M. Watson L41: Advanced Operating Systems 25 October 2016 6 / 21

What is an operating system?

Other kinds of operating systems (cont.)

What if we rearrange the process-model and system-call boxes?

I Microkernels, library operating systems, unikernelsI Shift code out of the kernel into userspace to reduce TCB;

improve robustness/flexibility; ‘bare-metal’ appsI Early 1990s: Microkernels are king!I Late 1990s: Microkernels are too slow!I 2000s/2010s: Microkernels are back! But now ‘hypervisors’I Sometimes: alternative linkage (e.g., programming-language)

I HypervisorsI Kernels host applications; hypervisors host virtual machinesI Virtualised hardware interface rather than POSIXI Paravirtualisation reintroduces OS-like interfaces for performanceI A lot of microkernel ideas have found a home hereI E.g., System/370, VMware, Xen, KVM, VirtualBox, bhyve, ...

Dr Robert N. M. Watson L41: Advanced Operating Systems 25 October 2016 7 / 21

What is an operating system?

What does an operating system do?

I Key hardware-software surface (cf. compilers)I System management: bootstrap, shutdown, watchdogsI Low-level abstractions and services

I Programming: processes, threads, IPC, program modelI Resource sharing: scheduling, multiplexing, virtualisationI I/O: device drivers, local/distributed filesystems, network stackI Security: authentication, encryption, permissions, labels, auditI Local or remote access: console, window system, SSH

I Libraries: math, protocols, RPC, cryptography, UI, multimediaI Other stuff: system log, debugging, profiling, tracing

Compiler? Text editor? E-mail package? Web browser? Can anoperating system be ‘distributed’?

Dr Robert N. M. Watson L41: Advanced Operating Systems 25 October 2016 8 / 21

Why study operating systems?

Why study operating systems?

The OS plays a central role in whole-system design when buildingefficient, effective, and secure systems:

I Key interface between hardware and softwareI Strong influence on whole-system performanceI Critical foundation for computer securityI Exciting programming techniques, algorithms, problems

I Virtual memory; network stacks; filesystems; runtime linkers; ...I Co-evolves with platforms, applications, usersI Multiple active research communitiesI Reusable techniques for building complex systemsI Boatloads of fun (best text adventure ever)

Dr Robert N. M. Watson L41: Advanced Operating Systems 25 October 2016 9 / 21

Why study operating systems?

Where is the OS research?

A sub-genre of systems research:

I Evolving hardware-software interfacesI New computation models / architecturesI New kinds of peripheral devices

I Integration with programming languages and runtimesI Concurrent/parallel programming models; schedulingI Security and virtualisationI Networking, storage, and distributed systemsI Tracing and debugging techniquesI As a platform for other research – e.g., mobile systems

Venues: SOSP; OSDI; USENIX ATC; EuroSys; HotOS; FAST; NSDI;HotNets; ASPLOS; USENIX Security; ACM CCS; IEEE S&P; ...

Dr Robert N. M. Watson L41: Advanced Operating Systems 25 October 2016 10 / 21

Why study operating systems?

What are the research questions?Just a few examples: by changing the OS, can I...

I create new abstractions for new hardware?I make my application run faster by...

I better masking latency?I using parallelism more effectively?I exploiting new storage mediums?I adopting distributed-system ideas in local systems?

I make my application more {reliable, power efficient}I limit the {security, privacy} implications of bad/exploited programs?I use new languages/analysis techniques in new ways?

Systems research focuses on evaluation with respect to applicationsor workloads: how can we measure whether it is {faster, better, ...}?

Dr Robert N. M. Watson L41: Advanced Operating Systems 25 October 2016 11 / 21

About L41

Teaching operating systems

I Two common teaching tropes:I Trial by fire: in micro, recreate classic elements of operating

systems: microkernels with processes, filesystems, etcI Research readings course: read, present, discuss, and write

about classic works of systems research

I This module adopts elements of both approaches while:I mitigating the risk of OS kernel hacking in a short course;I working on real-world systems rather than toys; andI targeting research skills not just operating-system design

I Trace and analyse real systems driven by synthetic benchmarksI Possible only because of recent developments in tracing

Dr Robert N. M. Watson L41: Advanced Operating Systems 25 October 2016 12 / 21

About L41

Aims of the module

Teach methodology, skills, and knowledge required to understand andperform research on contemporary operating systems by...

I Teaching systems-analysis methodology and practiceI Exploring real-world systems artefactsI Developing scientific writing skillsI Reading selected original systems research papers

Dr Robert N. M. Watson L41: Advanced Operating Systems 25 October 2016 13 / 21

About L41

PrerequisitesWe will take for granted:

I High-level knowledge of operating systems gained in anundergraduate course (or equivalent); e.g.:

I What schedulers doI What processes are... and how they differ from threadsI What Interprocess Communication (IPC) doesI How a simple filesystem might work

I Reasonable fluency in reading/producing multithreaded CI Comfort with the UNIX command-line environmentI Undergraduate skills with statistics

(mean/median/mode/stddev/t-tests/linear regression/boxplots/scatterplots/...)

You can pick up some of this as you go (e.g., IPC, t-tests), but willstruggle if you are missing most of these

Dr Robert N. M. Watson L41: Advanced Operating Systems 25 October 2016 14 / 21

About L41

Module structureI One-hour lectures in FS-07 (×6)

I Theory, methodology, architecture, and practice

I Two-hour labs in SW-02 (×5)I 10–20-minute lecturelets on artefacts and practical skillsI Remainder on hands-on measurement and experimentationI Optional exploratory questions vs. experimental goals

I Assigned readingsI Selected portions of module textsI Historic and contemporary research papers

I Assessed lab reportsI Based on experiments done in (and out) of labsI Refine scientific writing style suitable for systems researchI One ‘practice run’ marked but not assessedI Two assessed; 50% of final mark each

Dr Robert N. M. Watson L41: Advanced Operating Systems 25 October 2016 15 / 21

About L41

Rough module schedule and decompositionI Submodule 1: Introduction to kernels and tracing/analysis

I 2 lectures, 1 lab (I/O)I Introduction: OSes, Systems Research, and L41I The Kernel: Kernel and TracingI First lab report due

I Submodule 2: The Process ModelI 2 lectures, 2 labs (IPC, PMC)I The Process Model (1) - Binaries and ProcessesI The Process Model (2) - Traps, System Calls, and Virtual MemoryI Second lab report due

I Submodule 3: TCP/IPI 2 lectures, 2 labs (TCP state machine, congestion control)I The Network Stack (1) - Sockets, NICs, and Work DistributionI The Network Stack (2) - TCP protocolI Final lab report due

Dr Robert N. M. Watson L41: Advanced Operating Systems 25 October 2016 16 / 21

About L41

The platform

I BeagleBone BlackI 1GHz ARM Cortex A-8

32-bit CPUI Superscalar pipeline, MMU,

L1/L2 cachesI FreeBSD operating systemI DTraceI ‘potted benchmarks’

Dr Robert N. M. Watson L41: Advanced Operating Systems 25 October 2016 17 / 21

About L41

Labs and lab reports

Lab reports document an experiment and analyse its results – typicallyin the context of a hypothesis that will be tested.

A lab report will contain at least the following sections:

1. Title + abstract2. Introduction3. Experimental setup and

methodology

4. Results and discussion5. Conclusion6. References7. Appendices

Some formats break out sections experimental setup vs. methodology,and results vs. discussion. The combined format seems to work betterfor systems experimentation as compared to, say, biology.

See lab-report notes on the website.

Dr Robert N. M. Watson L41: Advanced Operating Systems 25 October 2016 18 / 21

About L41

Module texts - core materialYou will need to make frequent reference to these books both in thelabs and outside of the classroom:

I Operating systems: Marshall Kirk McKusick, George V.Neville-Neil, and Robert N. M. Watson, The Design andImplementation of the FreeBSD Operating System, 2nd Edition,Pearson Education, Boston, MA, USA, September 2014.

I Performance measurement: Raj Jain, The Art of ComputerSystems Performance Analysis: Techniques for ExperimentalDesign, Measurement, Simulation, and Modeling, Wiley -Interscience, New York, NY, USA, April 1991.

I Tracing and profiling: Brendan Gregg and Jim Mauro, DTrace:Dynamic Tracing in Oracle Solaris, Mac OS X and FreeBSD,Prentice Hall Press, Upper Saddle River, NJ, USA, April 2011.

Dr Robert N. M. Watson L41: Advanced Operating Systems 25 October 2016 19 / 21

About L41

Module texts - supplemental material

If your OS recollections feel a bit hazy:

I Operating systems: Abraham Silberschatz, Peter Baer Galvin,and Greg Gagne, Operating System Concepts, Eighth Edition,John Wiley & Sons, Inc., New York, NY, USA, July 2008.

If you want to learn a bit more about architecture and measurement:

I Performance measurement and diagnosis: Brendan Gregg,Systems Performance: Enterprise and the Cloud, Prentice HallPress, Upper Saddle River, NJ, USA, October 2013.

Dr Robert N. M. Watson L41: Advanced Operating Systems 25 October 2016 20 / 21

About L41

Reading for Next Lecture

I McKusick, et al. - Chapter 3I Cantrill, et al. 2004 - full article

Dr Robert N. M. Watson L41: Advanced Operating Systems 25 October 2016 21 / 21