csperkins.org

Advanced Systems Programming H (2020-2021)

Lecture 1: Introduction

Lecture 1 provides an introduction to the course. It reviews the course aims and objectives, intended learning outcomes, and timetable; and it outlines the means by which the course will be assessed. This lecture is comprised on one part.

Part 1: Advanced Topics in Systems Programming

Lecture 1 comprises a brief introduction to the course.

00:00:00.000 Welcome to Advanced Systems Programming (H) for

00:00:04.529 the 2020-2021 academic year.

00:00:05.973 For those who don’t know me,

00:00:08.241 my name is Colin Perkins. I’m the

00:00:10.769 lecturer and coordinator for this course.

00:00:12.937 In this first lecture, I’ll introduce the

00:00:15.565 course materials, and review the aims,

00:00:17.733 objectives, and administration of the course.

 

00:00:21.000 As I said, I’m Colin Perkins,

00:00:23.200 and I’ll be the lecturer for this

00:00:25.650 course.

00:00:26.750 If you have questions about the material

00:00:29.300 covered in the course, my email address

00:00:31.750 is on the slide, and I’m happy

00:00:34.200 to answer questions via email. We also

00:00:36.650 have office hours and discussion sessions throughout

00:00:39.100 the course, and a chat room in

00:00:41.550 Microsoft Teams. In normal times, you can

00:00:44.000 find my office in Lilybank Gardens.

00:00:46.100 The lecture slides, recordings, transcripts, lab exercises,

00:00:48.650 and other course materials can be found

00:00:51.100 on Moodle. The material is also on

00:00:53.550 my website at the URL listed.

 

00:00:56.000 What is the purpose of this course?

00:00:58.903 Well, over the last 10-15 years,

00:01:01.406 we’ve seen a shift in the technology

00:01:04.209 landscape.

00:01:05.359 We’ve gone from a world dominated by

00:01:08.263 desktop PCs running Windows, with a relatively

00:01:11.066 small number of servers, often located on-site,

00:01:13.869 supporting those PCs, to a world dominated

00:01:16.672 by smartphones and cloud computing.

00:01:18.674 Devices are now much more likely to

00:01:21.577 be mobile and battery powered, and connected

00:01:24.380 to a network that lets them offload

00:01:27.184 computation and data to remote cloud computing

00:01:29.987 resources in dedicated data centres. This changes

00:01:32.790 the way we use those devices,

00:01:35.193 and the type of applications we use.

00:01:37.996 We’re also increasingly using real-time applications,

00:01:40.398 like telephony, video conferencing, or streaming video

00:01:43.202 on our smartphones, tablets, and other general

00:01:46.005 purpose computing devices.

00:01:47.206 There are also increasing numbers of servers.

00:01:50.109 These are not battery powered or mobile,

00:01:52.912 but are also increasingly power-aware, as data

00:01:55.715 centre operators strive to reduce the electricity

00:01:58.519 and air conditioning costs of operating their

00:02:01.322 services, and to reduce their environmental impact.

00:02:04.125 The devices we use are increasingly concurrent.

00:02:07.028 In part because a data centre is

00:02:09.831 the natural home for concurrency, running millions

00:02:12.634 of instances of the same service to

00:02:15.437 meet the needs of different users.

00:02:17.840 But it’s also, in part, because the

00:02:20.643 need to control power consumption has pushed

00:02:23.446 mobile CPUs in the direction of multicore

00:02:26.250 support.

 

00:02:26.000 Despite these massive shifts, the underlying operating

00:02:29.233 system and software stack has changed relatively

00:02:32.367 little.

00:02:33.564 For example, the operating system on my

00:02:36.798 smartphone runs the same underlying software stack

00:02:39.931 as the desktop workstation I used in

00:02:43.064 1992. It uses the same operating system

00:02:46.198 kernel, is programming using the same programming

00:02:49.331 language, and shares many of the same

00:02:52.464 software libraries, APIs, and features.

00:02:54.702 The code has evolved and changed,

00:02:57.488 of course, but the organisation, architecture,

00:03:00.174 and underlying approaches to writing the system

00:03:03.307 remain surprisingly similar.

 

00:03:04.000 In this course, we’ll explore some new

00:03:06.704 techniques and approaches that aim to support

00:03:09.309 safer, and more effective, systems programming.

00:03:11.541 We’ll talk about advances in programming languages

00:03:14.245 that allow us to retain the advantages

00:03:16.849 of systems programming languages, such as C,

00:03:19.454 in terms of control over data representations

00:03:22.058 and high performance, while being much safer

00:03:24.662 and easier to program.

00:03:26.151 And we’ll talk about how operating systems

00:03:28.855 might change, to better support writers of

00:03:31.459 device drivers, low-level networking code, and so

00:03:34.063 on, with the goal of improving safety

00:03:36.668 and security of the overall system.

 

00:03:40.000 The aims of the course are to

00:03:42.821 explore the features of modern programming languages

00:03:45.543 and operating systems that can ease the

00:03:48.264 challenges of systems programming, focussing on type

00:03:50.985 systems and run-time support.

00:03:52.540 We’ll review the literature on systems programming

00:03:55.362 and operating systems design, discuss limitations of

00:03:58.083 deployed systems, and consider how systems programming

00:04:00.804 might evolve to address the challenges of

00:04:03.526 supporting modern computing systems.

00:04:05.081 In particular, the course will aim to

00:04:07.902 highlight how modern programming languages, and new

00:04:10.624 approaches to software development, can help ensure

00:04:13.345 system correctness and security.

 

00:04:16.000 By the end of the course,

00:04:18.414 you should understand the advantages and disadvantages

00:04:21.114 of using C as a systems programming

00:04:23.814 language. You should be able to discuss

00:04:26.514 the benefits of using a modern,

00:04:28.829 strongly typed, systems programming language as an

00:04:31.529 alternative. And you should have an understanding

00:04:34.229 of the concepts behind type-driven development,

00:04:36.543 and the role of the type system

00:04:39.243 in ensuring code correctness.

00:04:40.786 You should have some understanding of the

00:04:43.586 challenges in writing secure systems code,

00:04:45.900 in particular with respect to memory safety

00:04:48.600 and parsing untrusted input. You should understand

00:04:51.300 why these tasks are difficult in C.

00:04:54.000 And you should understand the trade-offs inherent

00:04:56.800 in garbage collection, reference counting, region-based memory

00:04:59.500 management, and manual memory management, and know

00:05:02.200 when it’s appropriate to use each approach.

 

00:05:06.000 You should understand why multicore systems have

00:05:09.172 become popular, and have an understanding of

00:05:12.244 different approaches to concurrent programming, including multithreading,

00:05:15.317 actor-based systems, concurrent transactions, and coroutines,

00:05:17.950 and what are the trade-offs between them.

00:05:21.022 And, finally, you should be able to

00:05:24.194 write simple programs in a modern systems

00:05:27.267 programming language to demonstrate your understanding.

 

00:05:31.000 This course follows-on from the Systems Programming,

00:05:33.882 Operating Systems, Networked Systems, and Functional Programming

00:05:36.664 courses of the Glasgow Computing Science degree.

00:05:39.445 You are expected to be familiar with

00:05:42.327 the C programming language, and to understand

00:05:45.109 the basics of operating systems and networking.

00:05:47.891 A conceptual understanding of functional programming is

00:05:50.673 also assumed.

00:05:51.468 You are expected to be able to

00:05:54.349 read and understand C programs, but this

00:05:57.131 course does not require you to write

00:05:59.913 programs in C or Haskell.

 

00:06:03.000 The course is structured as ten lectures

00:06:05.449 and five laboratory exercises.

00:06:06.792 The lectures are organised once per week

00:06:09.241 for the first eight weeks, followed by

00:06:11.590 a one-week gap, and then finishing up

00:06:13.940 with the final two lectures in the

00:06:16.289 tenth week.

00:06:16.960 Labs are organised weekly, with some exercises

00:06:19.410 expected to take one week to complete,

00:06:21.759 while others will take two weeks.

00:06:23.773 The labs finish after eight weeks.

00:06:25.786 There’s also a weekly office hour.

 

00:06:29.000 Lecture recordings will be made available ahead

00:06:31.702 of time, and will comprise approximately two

00:06:34.304 hours worth of material per week,

00:06:36.534 split into several shorter parts.

00:06:38.393 Each lecture will be accompanied by a

00:06:41.095 set of discussion questions, that will be

00:06:43.697 available on Moodle and on the course

00:06:46.299 website. These discussion questions are not assessed,

00:06:48.901 and are intended to help you understand

00:06:51.503 the material.

00:06:52.246 We have a live session on Zoom,

00:06:54.948 timetabled from 10:00-11:00 on Monday mornings,

00:06:57.178 and also 1:00-2:00pm on Monday afternoon in

00:06:59.780 week 10. These sessions are intended for

00:07:02.382 a discussion of the lecture material and

00:07:04.984 questions. You should watch the lecture videos,

00:07:07.586 and think about the discussion questions,

00:07:09.816 before the timetabled sessions.

00:07:11.303 This discussion slot is your main opportunity

00:07:14.005 to ask questions about the material,

00:07:16.236 and I encourage you to come prepared

00:07:18.838 to use this slot for discussion.

00:07:21.068 The more questions and discussion we have,

00:07:23.670 the more useful it will be.

 

00:07:27.000 Immediately following the lecture discussion, from 11:00-12:00

00:07:29.946 on Monday mornings, is the scheduled office

00:07:32.791 hour.

00:07:33.948 This is your time to ask questions

00:07:36.893 and discuss course materials with me,

00:07:39.333 in a one-to-one Zoom call, for any

00:07:42.178 questions you don’t want to ask in

00:07:45.024 the open discussion session.

 

00:07:47.000 Finally, there will be weekly labs during

00:07:49.402 the first eight weeks of the course.

00:07:51.704 These will run using Microsoft Teams.

00:07:53.678 As with the lectures, the lab materials

00:07:56.080 will be made available in advance of

00:07:58.382 the timetabled sessions, and the exercises are

00:08:00.684 to be completed in your own time.

00:08:02.987 The timetabled sessions, from 1:00-2:00pm on Mondays,

00:08:05.389 are for live support with the lab

00:08:07.691 exercises. You should try to solve the

00:08:09.993 exercise, and think of questions you might

00:08:12.296 need to ask, before the timetabled support

00:08:14.598 slot, so I can effectively help you.

 

00:08:18.000 This course follows the usual model of

00:08:20.681 an exam worth 80% of the marks,

00:08:23.261 with the coursework being worth the remaining

00:08:25.842 20%.

00:08:26.960 The assessed coursework will comprise two exercises,

00:08:29.641 each worth 10% of the marks.

00:08:31.853 The first assessed exercise will be an

00:08:34.534 essay question about memory management. It will

00:08:37.114 be made available at the start of

00:08:39.695 Lecture 5, and will be due at

00:08:42.275 the start of Lecture 7.

00:08:44.119 The second assessed exercise will be a

00:08:46.799 concurrent programming exercise using the Rust programming

00:08:49.380 language. It will be made available at

00:08:51.960 the start of Lecture 7, and will

00:08:54.541 be due at the start of Lecture

00:08:57.122 9.

00:08:58.240 There will also be an exam,

00:09:00.552 worth 80% of the marks for the

00:09:03.133 course, sometime in April or May.

00:09:05.345 A sample exam paper, with worked answers,

00:09:07.925 is available on Moodle.

 

00:09:09.000 The course will use the Rust programming

00:09:11.696 language to illustrate type-driven design and ownership

00:09:14.292 tracking for systems programming. You’re expected to

00:09:16.887 learn how to program in Rust as

00:09:19.483 part of this course.

00:09:20.967 The two books listed on the slide

00:09:23.662 provide good introductions to Rust, to complement

00:09:26.258 the material that we’ll cover in the

00:09:28.854 lectures.

00:09:29.975 The first book, The Rust Programming Language,

00:09:32.671 by Steve Klabnik and Carol Nichols,

00:09:34.896 is the standard tutorial introduction to Rust.

00:09:37.492 It’s available for free on the Rust

00:09:40.087 language website.

00:09:40.829 The second book, Programming Rust, by Jim

00:09:43.525 Blandy and Jason Orendorff, is more expensive,

00:09:46.121 but I think it has the better

00:09:48.717 explanations of many of the concepts.

00:09:50.942 The link on the slides offers free

00:09:53.537 access to this book online, via the

00:09:56.133 University library.

00:09:56.875 I strongly recommend that you read one

00:09:59.571 of these books, to build on the

00:10:02.167 lectures and lab exercises.

 

00:10:04.000 In addition to the two books on

00:10:06.734 the Rust programming language, the lectures will

00:10:09.368 also cite various research papers. You are

00:10:12.001 expected to read these papers.

00:10:13.883 For all research papers, either a URL

00:10:16.617 or a Digital Object Identifier, a DOI,

00:10:19.250 will be provided. If a DOI is

00:10:21.884 given, go to dx.doi.org, enter the DOI,

00:10:24.518 and it will redirect you to the

00:10:27.152 paper.

00:10:28.278 All papers mentioned in the course are

00:10:31.012 accessible at no cost from the campus

00:10:33.646 network, or via the University’s VPN service.

00:10:36.280 In most cases, you should also be

00:10:38.914 able to get access by following the

00:10:41.547 “Institutional Login” option on the publisher’s website.

00:10:44.181 Under no circumstances should you pay to

00:10:46.915 access any of these papers. If you

00:10:49.549 can’t get access for free, ask me,

00:10:52.183 and I’ll send you a copy.

00:10:54.440 Indeed, don’t pay to access any research

00:10:57.174 papers!

00:10:58.300 Authors of research papers don’t get paid

00:11:01.034 if you buy a copy of their

00:11:03.668 paper from the publisher. In fact,

00:11:05.926 most research paper authors actually pay to

00:11:08.559 publish their papers. If you want a

00:11:11.193 copy of a research paper, and can’t

00:11:13.827 find it for free online, then email

00:11:16.461 the author and ask. They’ll almost always

00:11:19.095 just send you copy by return.

00:11:21.352 As I said earlier, you are expected

00:11:24.086 to read these papers. When you do,

00:11:26.720 read them to understand the concepts and

00:11:29.354 ideas, not the details. Don’t worry if

00:11:31.988 you don’t understand everything in these papers,

00:11:34.621 and skip over details and parts you

00:11:37.255 don’t understand.

00:11:38.008 You’re looking to get a feel for

00:11:40.742 the ideas, not to understand every detail.

00:11:43.375 Some of the ideas mentioned in the

00:11:46.109 papers will be good, some less so.

00:11:48.743 Some will be interesting, but impractical.

00:11:51.001 And what’s impractical today, might become important

00:11:53.634 tomorrow, due to changes in technology and/or

00:11:56.268 society.

00:11:57.395 The goal of the papers is to

00:12:00.128 help you think more deeply about the

00:12:02.762 subject, not to suggest particular desirable outcomes.

00:12:05.396 If you’ve not read many research papers

00:12:08.130 before, the How to Read a Research

00:12:10.764 Paper page, linked from the slide,

00:12:13.021 might be useful.

 

00:12:13.000 That concludes these introductory remarks.

00:12:15.060 The main lecture content starts in week

00:12:17.904 2. Please make sure you watch lecture

00:12:20.648 2 and think about the discussion questions

00:12:23.392 before then, and come prepared to discuss.

00:12:26.136 The labs start in week 1.

00:12:28.588 Please review the lab 1 handout and

00:12:31.332 start on the exercises.

Discussion

The discussion session in week 1 will review the course structure, goals, and logistics. There will be time to answer ask any questions about the course, lectures, and labs.