csperkins.org

Advanced Systems Programming H/M (2022-2023)

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 of one part.

Part 1: Advanced Topics in Systems Programming

Part 1 of the lecture comprises a brief introduction to the course.

00:00:00.000 Welcome to advanced systems programming.

 

00:00:03.200 For those who don't know me, my name is Colin Perkins,

00:00:05.933 and I'll be giving the lectures for this course.

 

00:00:09.133 in this first lecture, I’ll introduce the course

00:00:11.600 and talk about how the material will be structured.

 

00:00:16.433 As I said, I'm Colin Perkins

00:00:18.066 and I'll be giving the lectures for this course.

 

00:00:21.133 I'll be joined by Lito Michala,

00:00:22.766 who'll be running the labs and the course work

 

00:00:25.633 Our contact details are on the slide.

 

00:00:28.933 If you have any questions about the material

00:00:30.733 covered in the course

00:00:31.766 we're happy to answer them via email.

 

00:00:34.433 We also have office hours and discussion sessions

00:00:36.700 throughout the course.

00:00:38.233 You can find my office in Lilybank Gardens,

00:00:40.700 and Lito is in the Sir Alwyn Williams body.

 

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

00:00:49.000 and other course materials can be found on Moodle.

 

00:00:54.266 So what's this course about?

 

00:00:57.333 Well, over the last 10 to 15 years

00:00:59.800 we've seen a shift in the technology landscape.

 

00:01:03.233 We've gone from a world dominated by

00:01:05.166 desktop PCs running windows.

00:01:07.566 with a relatively small number of servers,

00:01:09.666 often located on-site,

00:01:11.366 to support those PCs,

00:01:13.633 to a world dominated by smartphones and cloud computing

 

00:01:18.566 Devices are now much more likely to be mobile

00:01:21.133 and battery-powered,

00:01:22.633 and connected to a network that lets them offload

00:01:24.666 computation and data

00:01:26.000 to remote cloud computing resources

00:01:28.433 in dedicated data centers.

 

00:01:31.933 This changes the way we use those devices,

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

 

00:01:38.300 We're also increasingly using real-time applications,

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

00:01:46.133 on our smartphones, tablets,

00:01:47.900 and other general-purpose computing devices.

 

00:01:52.400 And there are also increasing numbers of servers.

 

00:01:55.800 These are not battery-powered or mobile,

00:01:58.333 but they are also increasingly power-aware,

00:02:01.100 as data center operators strive to

00:02:02.866 reduce the electricity and air conditioning costs

00:02:05.500 of operating their services

00:02:07.833 and to reduce their environmental impact.

 

00:02:12.000 And the devices we use are increasingly concurrent.

 

00:02:15.566 In part because the data center

00:02:17.466 is a natural home for concurrency,

00:02:19.666 running millions of instances of the same service

00:02:22.133 to meet the needs of different users.

 

00:02:24.866 But it's also, in part, because the need to control

00:02:27.066 the power consumption has pushed mobile CPUs

00:02:29.933 in the direction of multi-core support.

 

00:02:36.166 Despite these massive shifts,

00:02:38.200 the underlying operating system,

00:02:39.966 and software stack has changed relatively little.

 

00:02:44.700 The operating system on my smartphone for example.

00:02:48.233 runs the same underlying software stack

00:02:50.400 as the desktop workstation I used in 1992,

00:02:54.266 30 years ago.

 

00:02:56.900 It uses the same operating system kernel.

 

00:02:59.866 It's programmed using the same programming language,

00:03:02.766 and shares many of the same software libraries,

00:03:05.066 APIs, and features.

 

00:03:08.433 The code has evolved and changed, of course.

00:03:11.133 but the organization, architecture,

00:03:13.333 and underlying approaches

00:03:14.566 to writing the system remain surprisingly similar.

 

00:03:19.266 This technology and programming model

00:03:21.133 is increasingly limited

 

00:03:22.700 and increasingly limiting.

 

00:03:27.833 In this course we'll explore some new technologies

00:03:30.600 and approaches that aims to support safer,

00:03:33.033 and more effective, systems programming.

 

00:03:36.400 We'll talk about advances in programming languages

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

00:03:41.133 of systems programming languages,

00:03:44.166 such as C,

00:03:46.033 in terms of control over data representation

00:03:48.966 and high performance,

00:03:50.900 while being much safer and much easier to program.

 

00:03:54.600 We'll talk about how operating systems might change

00:03:57.366 to better support writers of device drivers,

00:03:59.966 low-level networking code, and so on.

00:04:02.800 with the goal of improving safety

00:04:04.700 and security of the overall system.

 

00:04:11.933 The aims of the course

00:04:13.333 are to explore the features

00:04:14.733 of modern programming languages

00:04:16.200 and operating systems

00:04:18.166 that can ease the challenges of systems programming,

00:04:21.133 focusing on type systems and runtime support.

 

00:04:25.866 We'll review the literature on systems programming

00:04:28.400 and operating systems design,

00:04:30.800 discuss limitations of deployed systems.

00:04:33.733 and consider how systems programming

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

00:04:38.466 supporting modern computing systems.

 

00:04:42.166 In particular.

00:04:43.466 the course will aim to highlight how

00:04:45.166 modern programming languages

00:04:47.166 and new approaches to software development,

00:04:49.766 can help ensure system correctness and security.

 

00:04:54.300 Fundamentally, we'll be looking at how systems

00:04:57.033 programming is changing to support new applications

00:04:59.666 and new uses.

 

00:05:05.333 What are the expected learning outcomes?

 

00:05:09.200 Well, first and most importantly.

00:05:12.100 by the end of the course,

00:05:13.366 you should understand the advantages,

00:05:15.033 and disadvantages,

00:05:16.300 of using C as a system's programming language

 

00:05:20.733 You should be able to discuss the

00:05:22.066 benefits of using a modern,

00:05:23.700 strongly-typed, systems programming

00:05:25.300 language as an alternative.

 

00:05:27.933 And you should have an understanding

00:05:29.433 of the concepts behind type-driven development,

00:05:32.100 and the role of the type system

00:05:34.500 in ensuring code in ensuring code correctness.

 

00:05:41.266 Second, you should have some understanding

00:05:43.933 of the challenges in writing secure systems code

 

00:05:48.533 In particular, you should understand some of the issues

00:05:51.000 around memory safety

00:05:52.666 and parsing untrusted network inputs.

 

00:05:56.433 And you should understand why these tasks

00:05:58.500 are difficult in C.

 

00:06:03.733 Third, you should understand

00:06:05.766 the basics of how garbage collection,

00:06:07.966 reference counting,

00:06:09.233 region-based memory management,

00:06:11.133 and manual memory management work.

 

00:06:14.266 You should have some idea when it's appropriate

00:06:16.300 to use each approach,

00:06:17.733 and what are the trade-offs between them?

 

00:06:23.500 You should understand why multicore systems

00:06:25.733 are becoming popular,

00:06:27.600 and the hardware trends which are driving this.

 

00:06:30.466 And you should have an understanding of

00:06:32.200 different approaches to to concurrent programming,

00:06:35.366 including multi-threading,

00:06:37.233 actor-based systems,

00:06:38.800 concurrent transactions,

00:06:40.200 and coroutines,

00:06:42.266 and what are the different trade-offs

00:06:44.100 and strengths and weaknesses between them?

 

00:06:49.166 And, finally, you should be able to write simple

00:06:51.133 programs in a modern systems programming

00:06:53.200 language to demonstrate your understanding.

 

00:06:58.300 There are a number of prerequisites for this course.

 

00:07:02.900 Firstly, you're expected to be familiar

00:07:04.933 with the C programming language.

 

00:07:07.766 You won't need to write any C programs in this course,

00:07:10.733 but you'll need to read and understand C code.

 

00:07:14.733 One of the aims of this course

00:07:16.400 is to make you aware of the strengths

00:07:18.100 and weaknesses of C as a programming language,

00:07:20.700 and to compare C to other languages.

 

00:07:23.966 To do this, you need to understand C programming.

 

00:07:28.300 You need to understand also the basics of

00:07:30.300 operating systems and networking.

 

00:07:33.266 This is a systems programming course,

00:07:35.600 and operating systems and networks

00:07:37.333 are two of the main areas where systems programming is used.

 

00:07:42.333 And you need a conceptual understanding of

00:07:44.233 functional programming.

 

00:07:46.666 You won't need to read more than a few lines of

00:07:48.700 Haskell code.

00:07:50.166 And you certainly won't need to write

00:07:52.100 any Haskell programs.

 

00:07:54.333 But the ideas behind Haskell are important.

 

00:07:58.033 We'll be talking a lot about how

00:07:59.566 functional programming concepts,

00:08:01.733 and some of the ideas around modern type systems,

00:08:05.066 both of which were pioneered in Haskell,

00:08:07.666 can be used in more mainstream

00:08:09.266 systems programming tasks.

 

00:08:13.333 This material broadly matches the systems programming,

00:08:16.266 operating systems,

00:08:17.766 networked systems,

00:08:19.066 and functional programming

00:08:20.333 courses in the Glasgow Computing science degree.

 

00:08:24.233 You can take this course if you haven't

00:08:25.866 done those other courses,

00:08:27.633 but you might need to do some catching up in your own time.

 

00:08:33.800 The course is structured as a mix of lectures and labs.

 

00:08:38.166 The lectures run weekly,

00:08:39.633 with a new topic each week for 10 weeks.

 

00:08:42.833 Lectures are pre-recorded,

00:08:44.366 and there's a group discussion slot

00:08:46.233 and Q-and-A each week.

 

00:08:49.333 The labs are also organized weekly,

00:08:52.300 but some exercises are expected to take one week

00:08:54.600 to complete, while others will take two weeks.

 

00:08:57.833 The labs finish after nine weeks

 

00:09:02.900 Lecture recordings will be made available ahead of time,

00:09:06.433 and will comprise around an hour's worth of material

00:09:08.866 each week, split into several shorter parts.

 

00:09:13.400 Each lecture will be accompanied

00:09:14.900 by a set of discussion questions

00:09:17.100 that will be available on moodle and on the course website.

 

00:09:21.466 These discussion questions are not assessed,

00:09:24.033 and are intended to help you understand the material.

 

00:09:27.866 The sessions timetabled from

00:09:29.300 10:00 to 12:00 on Monday mornings

00:09:31.166 are intended for a discussion

00:09:32.666 of the lecture material and questions.

 

00:09:35.766 You must watch the lecture videos,

00:09:37.733 and think about the discussion questions,

00:09:40.366 before the timetabled sessions.

 

00:09:44.233 This discussion slot

00:09:45.533 is your main opportunity to ask

00:09:47.133 questions about the material,

00:09:49.133 and you should come prepared to talk

00:09:50.766 and discuss the material in this time.

 

00:09:54.533 The more questions and discussion we have,

00:09:56.800 the more useful it will be.

 

00:10:01.900 In addition, there are weekly labs

00:10:03.933 during the first 9 weeks of the course.

 

00:10:07.133 As with the lectures,

00:10:08.533 the lab materials will be made available

00:10:10.500 in advance of the timetabled sessions.

 

00:10:13.933 You should read the lab sheets,

00:10:15.233 and make a start on the exercises,

00:10:17.333 in your own time before the labs.

 

00:10:20.866 The timetabled sessions,

00:10:22.666 from 1:00 to 2:00 on Mondays,

00:10:24.666 are for discussion and support of the lab exercises.

 

00:10:28.766 You should try to solve the lab exercises,

00:10:31.400 and think of questions you might need to ask,

00:10:34.033 before the timetable support slot

00:10:36.733 so we can effectively help you.

 

00:10:40.500 Many of the labs also have a discussion component.

 

00:10:44.200 For these labs, read the handouts,

00:10:46.700 think about the questions,

00:10:48.400 and come prepared to discuss the material

00:10:50.633 in small groups during the lab sessions.

 

00:10:57.500 The course will use the Rust

00:10:59.000 programming language to illustrate type-driven

00:11:01.000 design and ownership tracking for systems programming.

 

00:11:05.400 You're expected to learn the basics of how to program

00:11:07.766 in Rust as part of this course.

 

00:11:11.666 The two books listed on the slide

00:11:13.700 provide good introductions to Rust

00:11:15.800 to complement the material we'll cover in the lectures.

 

00:11:20.266 The first book,

00:11:21.333 the Rust Programming Language,

00:11:23.233 by Steve Klabnik and Carol Nichols,

00:11:26.200 is the standard tutorial introduction to Rust.

 

00:11:30.266 It's available for free on the Rust language website.

 

00:11:35.000 The second book,

00:11:36.433 Programming Rust,

00:11:37.500 by Jim Blandy and Jason Orendorff,

00:11:40.533 is more expensive if you buy it,

00:11:43.066 but I think it has the better explanations

00:11:44.800 of many of the concepts.

 

00:11:47.600 The link on the slide

00:11:48.866 offers free access to this book

00:11:50.466 online via the University Library.

 

00:11:54.366 I strongly recommend that you read one of these books

00:11:57.566 to build on the lectures and lab exercises.

 

00:12:03.933 In addition to the two books

00:12:05.500 on the Rust programming language,

00:12:07.666 the lectures will also refer to

00:12:09.233 various research papers and blog posts.

 

00:12:13.533 You're expected to read this material

 

00:12:17.766 For all the research papers,

00:12:19.600 either a URL

00:12:20.866 or a digital object identifier,

00:12:23.033 a DOI, will be provided.

 

00:12:26.300 If a DOI is given,

00:12:27.833 go to dx.doi.org

00:12:30.466 enter the DOI, and it will redirect you to the paper.

 

00:12:36.033 All the papers mentioned in the course

00:12:37.933 are accessible at no cost from the campus network.

00:12:41.100 or via the University's VPN service.

 

00:12:44.766 In most cases,

00:12:45.833 you should also be able to get access

00:12:47.366 by following the institutional login

00:12:49.433 option on the publishers website,

00:12:51.966 selecting the University of Glasgow,

00:12:53.866 and entering your login details.

 

00:12:57.566 Under no circumstances should you pay

00:12:59.633 to access any of these papers.

 

00:13:02.300 If you can't get access for free,

00:13:04.333 ask me and I'll email you

00:13:07.033 and send you a copy.

 

00:13:09.266 Indeed, don't, pay to access any research papers.

 

00:13:13.466 It's not perhaps widely known,

00:13:15.266 but authors of research papers don't get paid

00:13:17.700 if you buy a copy of their paper from the publisher.

 

00:13:21.600 In fact, most research paper authors

00:13:23.633 actually pay to publish their papers.

 

00:13:27.066 If you want a copy of a research paper,

00:13:29.066 and you can't find it for free online,

00:13:31.266 then email the author and ask.

 

00:13:33.600 They'll almost always just send you a copy by return.

 

00:13:38.500 Now, as I said earlier,

00:13:40.100 you're expected to read these papers.

 

00:13:43.400 When you do,

00:13:44.666 read them to understand the concepts and ideas,

00:13:47.466 not the details.

 

00:13:49.733 Don't worry If you don't understand

00:13:51.233 everything in the papers,

00:13:52.633 and skip over details

00:13:54.166 and parts you don't understand.

 

00:13:57.300 You're looking to get a feel for the ideas,

00:13:59.466 not to understand every detail.

 

00:14:03.300 Some of the ideas mentioned in the papers will be good,

00:14:06.100 some perhaps less so.

 

00:14:08.800 Some will be interesting, but impractical.

 

00:14:11.766 And what's impractical today

00:14:13.800 might become important tomorrow

00:14:15.766 due to changes in technology and/or society.

 

00:14:20.333 The goal of the papers

00:14:21.500 is to help you think more deeply about the subject,

00:14:24.533 not to suggest particular desirable outcomes.

 

00:14:29.666 If you've not read many research papers before,

00:14:33.233 the "How to read a Research paper" page

00:14:36.066 linked from the slide might be useful.

 

00:14:42.966 The course follows the usual model of an exam,

00:14:45.766 worth 80% of the marks,

00:14:47.700 with the coursework being worth the remaining 20%.

 

00:14:51.833 The assessed coursework will comprise

00:14:53.666 two exercises, each with 10% of the marks.

 

00:14:58.033 The first assessed exercise

00:14:59.966 will be an essay question about memory management.

 

00:15:03.400 It'll be made available at the start of Lecture 5,

00:15:06.200 and will be due at the start of Lecture 7.

 

00:15:10.100 The second assessed exercise

00:15:11.666 will be a concurrent programming exercise,

00:15:13.400 using the Rust programming language.

 

00:15:15.766 It'll be made available at the start of Lecture 7,

00:15:18.900 and will be due at the start of lecture 9.

 

00:15:22.933 There will also be an exam,

00:15:24.700 worth 80% of the marks for the course,

00:15:27.333 sometime in April or May.

 

00:15:30.266 Past papers, and a sample exam paper

00:15:32.433 with worked answers, are available on Moodle.

 

00:15:37.166 The material covered in the lectures and labs is examinable.

 

00:15:41.200 And, importantly,

00:15:42.566 so to are the ideas

00:15:43.900 discussed in the cited papers and blog posts.

 

00:15:48.533 The goal is to test your understanding of the concepts,

00:15:52.000 not to test your memory of all of the details.

 

00:15:55.600 Reading widely,

00:15:56.833 and broadly understanding the material,

00:15:59.000 is important.

 

00:16:00.900 If you only watch the lectures, and skip the reading,

00:16:04.233 you'll miss important ideas

 

00:16:09.866 That concludes the introductory remarks.

 

00:16:13.133 The main lecture content starts in week 2.

 

00:16:16.333 Please make sure you watch lecture 2,

00:16:18.366 and think about the discussion questions before then,

00:16:21.200 and come prepared to discuss.

 

00:16:24.233 The labs starting week one.

 

00:16:26.800 Please review the lab handouts

00:16:28.533 and start on the exercises before then.

 

00:16:31.066 Thank you.

Discussion

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