csperkins.org

Advanced Systems Programming H/M (2024-2025)

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

The first part of the lecture comprises a brief introduction to the course.

00:00:00.000 Welcome to Advanced Systems Programming.

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

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

 

00:00:09.041 In this first lecture, I'll introduce the course

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

 

00:00:15.333 As I said, I'm Colin Perkins, and I'm the

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

00:00:20.959 My contact details are on the slide.

 

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

00:00:26.500 covered in the course, I'm happy to answer them by email.

00:00:29.959 We also have labs and discussion sessions

00:00:32.667 throughout the course where we can talk about the

00:00:35.458 material and you can ask questions.

 

00:00:38.291 The lecture slides, recordings, transcripts, lab

00:00:41.500 exercises and other course materials can also be

00:00:45.041 found on Moodle and on my website.

 

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

 

00:00:52.500 Well, over the last 15 years or so, we've seen a

00:00:55.375 shift in the technology landscape.

 

00:00:58.250 We've gone from a world dominated by desktop PCs

00:01:01.667 running Windows, with a relatively small number

00:01:05.250 of servers, often located on site, to support those PCs,

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

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

00:01:17.625 battery powered, and connected to a network that

00:01:20.458 lets them offload computation and data to remote

00:01:24.000 cloud computing resources in dedicated data centers.

 

00:01:28.917 This changes the way we use those devices and the

00:01:31.500 types of applications we use.

 

00:01:34.458 We're also increasingly using real time

00:01:37.083 applications, like telephony, video conferencing,

00:01:41.375 streaming video, or gaming on our smartphones,

00:01:45.333 tablets, and other general purpose computing devices.

 

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

 

00:01:53.625 These are not battery powered or mobile, but they

00:01:56.333 are also increasingly power aware, as data center

00:02:00.125 operators strive to reduce the electricity and

00:02:03.333 air conditioning costs of operating their

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

 

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

 

00:02:14.792 In part, because the data center is a natural

00:02:18.417 home for concurrency, running millions of

00:02:21.000 instances of the same service to meet the needs

00:02:23.291 of different users.

 

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

00:02:28.041 control power consumption has pushed mobile CPUs

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

 

00:02:36.250 Despite these massive shifts, the underlying

00:02:39.291 operating system and software stack has changed

00:02:41.959 relatively little.

 

00:02:44.125 The operating system on my smartphone, for

00:02:47.208 example, runs the same underlying operating

00:02:50.291 system and software stack as the desktop work

00:02:53.500 station I used as a PhD student in 1993, 30 years ago.

 

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

 

00:03:03.417 It's programmed using the same programming

00:03:06.125 language, and shares many of the same software

00:03:09.000 libraries, APIs, and features.

 

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

00:03:15.542 But the organization, architecture, and

00:03:18.208 underlying approaches to writing the system

00:03:21.458 remain surprisingly similar.

 

00:03:25.000 This technology and programming model is

00:03:27.792 increasingly limited, and increasingly limiting.

 

00:03:33.625 In this course, we'll explore some new

00:03:35.917 technologies and new approaches that aim to

00:03:38.792 support safer and more effective systems programming.

 

00:03:43.375 We'll talk about advances in programming

00:03:45.250 languages that allow us to retain the advantages

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

00:03:51.000 in terms of control over data representation and

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

00:03:57.917 easier to program.

 

00:04:00.625 We'll talk about how operating systems might

00:04:02.708 change to better support writers of device

00:04:05.291 drivers, low-level networking code, and so on,

00:04:09.291 with the goal of improving safety and security

00:04:11.959 of the entire system.

 

00:04:16.500 The aims of the course are to explore the

00:04:19.208 features of modern programming languages and

00:04:21.834 operating systems that can ease the challenges of

00:04:25.333 systems programming, focusing on type systems and

00:04:28.542 runtime support.

 

00:04:31.542 We'll review the literature on systems

00:04:33.542 programming and operating systems design, discuss

00:04:37.041 limitations of deployed systems,

00:04:40.000 and consider how systems programming might evolve

00:04:42.750 to address the challenges of supporting modern

00:04:44.834 computing systems.

 

00:04:47.792 In particular, the course will aim to highlight

00:04:50.667 how modern programming languages and new

00:04:53.500 approaches to software development can help

00:04:56.166 ensure system correctness and security.

 

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

00:05:02.750 programming is changing to support new

00:05:05.208 applications and new uses.

 

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

 

00:05:14.417 Well, first and most importantly, by the end of

00:05:18.458 the course, you should understand the advantages

00:05:21.333 and disadvantages of using C as a systems

00:05:24.542 programming language.

 

00:05:27.291 You should be able to discuss the benefits of

00:05:29.750 using a modern, strongly typed systems

00:05:32.333 programming language as an alternative.

00:05:35.000 And you should have an understanding of the

00:05:36.959 concepts behind type-driven development and the

00:05:39.792 role of the type system in ensuring code correctness.

 

00:05:46.041 Second, you should have some understanding of the

00:05:49.166 challenges in writing secure systems code.

 

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

00:05:55.291 issues around memory safety and parsing untrusted

00:05:58.583 network inputs.

00:06:00.625 And you should understand why those tasks are

 

00:06:02.583 difficult in C.

 

00:06:06.834 Third, you should understand the basics of how

00:06:10.333 garbage collection, reference counting, region-

00:06:13.667 based memory management, and manual memory

00:06:16.875 management work.

 

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

00:06:22.125 to use each approach and what are the trade-offs

00:06:24.333 between them.

 

00:06:27.333 You should understand why multi-core systems are

00:06:30.041 becoming popular and the hardware trends which

00:06:32.750 are driving this.

 

00:06:34.208 And you should have an understanding of different

00:06:36.291 approaches to concurrent programming, including

00:06:38.875 multi-threading, actor-based systems, concurrent

00:06:42.792 transactions, and coroutines.

00:06:44.959 And what are the different trade-offs and

00:06:47.500 strengths and weaknesses between them.

 

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

00:06:53.708 programs in a modern systems programming language

00:06:56.208 to demonstrate your understanding.

 

00:07:01.000 There are a number of prerequisites for this course.

 

00:07:05.208 Firstly, you're expected to be familiar with the

00:07:07.917 C programming language.

 

00:07:10.667 You won't need to write any C programs in this

00:07:13.041 course, but you'll need to read and understand C code.

 

00:07:18.333 One of the aims of this course is to make you

00:07:20.625 aware of the strengths and weaknesses of C as a

00:07:23.333 programming language and to compare C to other languages.

 

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

 

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

00:07:35.041 operating systems and networking.

 

00:07:38.041 This is a systems programming course, and

00:07:40.959 operating systems and networks are two of the

00:07:43.125 main areas where systems programming is used.

 

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

00:07:49.333 functional programming.

 

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

00:07:54.333 Haskell code.

00:07:56.000 And you certainly won't need to write any Haskell programs.

 

00:08:00.083 But the ideas behind Haskell and functional

00:08:02.875 programming are important.

 

00:08:05.834 We'll be talking a lot about how functional

00:08:08.417 programming concepts and some of the ideas around

00:08:11.458 modern type systems, both of which were pioneered

00:08:14.625 in Haskell, can be used in more mainstream

00:08:17.834 systems programming tasks.

 

00:08:21.458 This material broadly matches the systems

00:08:24.667 programming, operating systems, network systems

00:08:28.166 and functional programming courses in the Glasgow

00:08:31.125 Computing Science degree.

 

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

00:08:35.917 those other courses, but you might need to do

00:08:39.500 some catching up in your own time.

 

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

 

00:08:49.083 The lectures run weekly with a new topic each

00:08:51.792 week for 10 weeks.

 

00:08:54.875 Lectures are pre-recorded and there's a group

00:08:57.792 discussion slot and Q&A each week.

 

00:09:02.000 The labs are also organized weekly, but some

00:09:04.917 exercises are expected to take one week to

00:09:07.458 complete, while others will take two weeks.

 

00:09:10.667 The labs finish after nine weeks.

 

00:09:16.583 Lecture recordings will be made available ahead

00:09:19.041 of time and will comprise around an hour's worth

00:09:21.917 of material each week, split into several shorter parts.

 

00:09:26.750 Each lecture will be accompanied by a set of

00:09:29.041 discussion questions that will be available on

00:09:31.250 Moodle and on the course website.

 

00:09:34.917 These discussion questions are not assessed and

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

 

00:09:41.500 The sessions timetabled on Monday mornings are

00:09:44.458 intended for a discussion of the lecture material

00:09:46.625 and questions.

 

00:09:49.000 You must watch the lecture videos and think about

00:09:51.542 the discussion questions before the timetabled sessions.

 

00:09:56.500 This discussion slot is your main opportunity to

00:09:58.959 ask questions about the material, and you should

00:10:02.041 come prepared to talk and discuss the material in

00:10:04.375 this time.

 

00:10:06.291 The more questions and discussion we have, the

00:10:09.083 more useful it will be.

 

00:10:13.667 In addition, there are weekly labs during the

00:10:16.417 first nine weeks of the course.

 

00:10:19.291 As with the lectures, the lab materials will be

00:10:21.792 made available in advance of the timetabled sessions.

 

00:10:26.000 You should read the lab sheets and make a start

00:10:28.375 on the exercises in your own time before the labs .

 

00:10:33.291 The timetabled sessions on Monday afternoons are

00:10:36.375 there for discussion and support of the lab exercises.

 

00:10:41.000 You should try to solve the lab exercises and

00:10:43.708 think of questions you might need to ask before

00:10:46.625 the timetabled support slot so we can effectively

00:10:49.750 help you.

 

00:10:52.458 Some of the labs involve programming, but many of

00:10:54.792 them also have a discussion component and are

00:10:57.333 perhaps closer to tutorials in nature.

 

00:11:01.708 For these labs, read the handouts, think about

00:11:04.583 the questions, and come prepared to discuss the

00:11:07.375 material during the lab sessions.

 

00:11:13.375 The course will use the Rust programming language

00:11:16.083 to illustrate type-driven design and ownership

00:11:18.959 tracking for systems programming.

 

00:11:22.291 You are expected to learn the basics of how to

00:11:24.583 program in Rust as part of this course.

 

00:11:28.834 The two books listed on the slide provide good

00:11:31.625 introductions to Rust to complement the material

00:11:34.083 we'll cover in the lectures.

 

00:11:37.000 The first book, The Rust Programming Language by

00:11:40.625 Steve Klabnick and Carol Nichols, is a standard

00:11:44.291 tutorial introduction to Rust.

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

 

00:11:52.458 The second book, Programming Rust by Jim Blandy

00:11:56.125 and Jason Orendorff, is more expensive if you buy

00:11:59.834 it, but I think it has the better explanations of

00:12:02.417 many of the concepts.

 

00:12:04.125 The link on the slide offers free access to this

00:12:07.458 book via the University Library.

 

00:12:12.250 I strongly recommend that you read one of these

00:12:14.625 books to build on the lectures and the lab exercises.

 

00:12:20.500 In addition to the two books on the Rust

00:12:22.750 programming language, the lectures will also

00:12:25.500 refer to various research papers and blog posts.

 

00:12:29.291 You are expected to read this material.

 

00:12:33.625 For all the research papers, either a URL or a

00:12:37.166 digital object identifier, a DOI will be provided.

 

00:12:42.792 If a DOI is given, go to dx.doi.org,

00:12:47.542 enter the DOI

00:12:49.375 and it will redirect you to the paper.

 

00:12:52.792 All the papers mentioned in the course are

00:12:54.917 accessible at no cost from the campus network or

00:12:58.291 via the University's VPN service.

 

00:13:02.250 In most cases, you should also be able to get

00:13:04.667 access by following the Institutional Login

00:13:07.250 option on the publisher's website, selecting the

00:13:10.750 University of Glasgow and entering your login details.

 

00:13:15.208 Under no circumstances should you pay to access

00:13:18.041 any of these papers.

 

00:13:20.500 If you can't get access for free, ask me and I'll

00:13:23.542 send you a copy.

 

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

 

00:13:30.542 It's perhaps not widely known, but authors of

00:13:33.250 research papers don't get paid if you buy a copy

00:13:36.250 of their paper from the publisher.

 

00:13:39.250 In fact, most research paper authors actually pay

00:13:42.542 to publish their papers.

 

00:13:45.208 If you want a copy of a research paper and you

00:13:48.041 can't find it for free online, then email the

00:13:50.959 author and ask.

 

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

 

00:13:58.000 Now, as I said earlier, you're expected to read

00:14:00.333 these papers.

 

00:14:02.625 When you do, read them to understand the concepts

00:14:05.542 and ideas, not the details.

 

00:14:08.917 Don't worry if you don't understand everything in

00:14:11.333 the papers, and skip over details and parts you

00:14:14.208 don't understand.

 

00:14:16.542 You're looking to get a feel for the ideas, not

00:14:19.291 to understand every detail.

 

00:14:22.917 Some of the ideas mentioned in these papers will

00:14:25.375 be good, some perhaps less so.

 

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

 

00:14:32.667 And what's impractical today might become

00:14:35.375 important tomorrow, due to changes in technology,

00:14:38.750 economics or society.

 

00:14:42.333 The goal of the papers is to help you think more

00:14:44.458 deeply about the subject, not to suggest

00:14:47.125 particular desirable outcomes.

 

00:14:50.708 And if you've not read many research papers

00:14:53.417 before, the "How to Read a Research Paper" paper

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

 

00:15:04.375 The course follows the usual model of an exam,

00:15:07.000 worth 80% of the marks, with the coursework being

00:15:10.333 worth the remaining 20%.

 

00:15:13.708 The assessed coursework will comprise two

00:15:16.041 exercises, each worth 10% of the marks.

 

00:15:20.750 The first assessed exercise will be an essay

00:15:22.625 question about memory management.

00:15:25.333 It will be made available at the start of Lecture

00:15:28.417 5, and will be due at the start of Lecture 7.

 

00:15:33.583 The second assessed exercise will be a concurrent

00:15:36.125 programming exercise, using the Rust programming

00:15:38.917 language.

 

00:15:40.333 It will be made available at the start of Lecture

00:15:43.166 7, and will be due on the day of Lecture 9.

 

00:15:48.083 There will also be an exam, worth 80% of the

00:15:50.375 marks for the course, sometime in April or May.

 

00:15:54.542 Past papers, and a sample exam paper with worked

00:15:57.875 answers, are available on Moodle.

 

00:16:02.125 The material covered in the lectures and labs is examinable.

 

00:16:06.166 And importantly, so are the ideas discussed in

00:16:09.458 the cited papers and blog posts.

 

00:16:12.834 The goal is to test your understanding of the

00:16:15.083 concepts, not to test your memory of all the details.

 

00:16:19.250 Reading widely, and broadly understanding the

00:16:22.041 material, is important.

 

00:16:24.625 If you only watch the lectures, and skim the

00:16:27.250 reading, you'll miss important ideas.

 

00:16:32.375 So that concludes these introductory remarks.

 

00:16:36.625 The main lecture content starts in Week 2.

 

00:16:40.750 Please make sure you watch Lecture 2, and think

00:16:43.500 about the discussion questions before then, and

00:16:46.041 come prepared to discuss.

 

00:16:48.875 The labs start in Week 1.

 

00:16:51.583 Please review the lab handouts, and start on the

00:16:55.083 exercises, and think about the discussion

00:16:57.208 questions before then.

 

00:16:59.041 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.