The final lecture concludes by reviewing the course material, and
discussing some possible future directions for systems programming.
The final part of the course talks about future directions and open
issues. It notes that there are still open questions around how best
to support concurrent programming, data centre-scale computing, and
large-scale distributed operating systems. It also highlights the benefits
of modern programming languages for developing programs that run within
a single system, and notes the challenges in scaling out to massively
distributed systems.
00:00:00.000
In this last lecture, I’d like to
00:00:02.862
talk about some open issues and future
00:00:05.724
directions for systems programming.
00:00:08.460
So, in this course we've discussed a
00:00:11.579
number of advanced topics in the systems
00:00:14.699
programming space.
00:00:15.690
We spent some time talking about what
00:00:19.520
is systems programming, and what distinguishes a
00:00:23.351
systems program from an applications program,
00:00:26.634
focusing on control over memory layout,
00:00:29.917
and performance needs, and so on
00:00:33.300
We spent a fair amount of time
00:00:36.420
talking about type systems, and type based
00:00:39.539
modelling and design, and thinking about the
00:00:42.659
benefits of advanced type systems for building
00:00:45.779
systems programs.
00:00:46.770
Thinking about some of the constraints and
00:00:50.144
issues around modelling the problem space using
00:00:53.518
types, and using that to help robustness
00:00:56.892
and security of programs.
00:00:58.920
We focused a lot on resource ownership
00:01:02.855
and memory management, and tracking how the
00:01:06.790
program works with, controls, and owns resources,
00:01:10.725
including memory, but also including state machines,
00:01:14.760
and the state variables in state machines.
00:01:18.424
And we spoke about different approaches to
00:01:22.088
memory management, the reference counting approaches,
00:01:25.229
garbage collection, and region-based memory management.
00:01:28.470
And we spent a fair amount of
00:01:30.907
time talking about concurrency.
00:01:32.400
Talking about message passing approaches to concurrency.
00:01:37.140
Talking about transactions, talking about co-routines and
00:01:40.716
asynchronous programming. And we spent some time
00:01:44.293
discussing why the common approach of using
00:01:47.869
multithreading,
00:01:48.480
locks, and shared mutable state, is not
00:01:52.038
an effective approach, and doesn't scale out
00:01:55.597
to larger systems, and is very hard
00:01:59.155
to get right.
00:02:00.780
And, we just finished up by talking
00:02:03.749
about some of the security considerations in
00:02:06.719
these systems, and thinking about
00:02:08.940
How we can use advanced type systems
00:02:12.967
to make explicit the assumptions in the
00:02:16.993
code, and reduce the risk of inconsistencies
00:02:21.120
which lead to security breaches. And we
00:02:24.426
spent some time talking about how memory
00:02:27.732
unsafety is the primary cause of security
00:02:31.038
vulnerabilities.
00:02:32.610
What did we learn from this?
00:02:36.480
Well, I think one of the key
00:02:39.846
distinguishing features with systems programs, is that
00:02:43.213
they need low-level control over the data
00:02:46.579
layout.
00:02:47.160
In order to effectively write device drivers,
00:02:50.615
in order to effectively write network protocols,
00:02:54.069
or file I/O,
00:02:55.650
and in order to make effective use
00:02:58.797
of memory, and fit within the cache,
00:03:01.945
and optimise the layout of data structures
00:03:05.092
to fit within the cache,
00:03:07.440
we need to be able to control
00:03:09.913
the way data is laid out in
00:03:12.387
memory.
00:03:12.840
One of the key features of systems
00:03:15.415
programs, is that they give that control.
00:03:18.090
And going forward, I expect systems programming
00:03:20.847
languages to continue to do that.
00:03:23.310
We need to be able to specify
00:03:25.513
exactly how a data structure is laid
00:03:27.716
out in memory, and to be able
00:03:29.919
to control whether it is allocated on
00:03:32.122
the stack or on the heap.
00:03:34.110
And to be able to box,
00:03:37.057
or unbox, data structures as we need
00:03:40.494
to, to get good performance.
00:03:43.050
In traditional systems programming languages, that control
00:03:48.580
has
00:03:49.470
come at the expense a lot of
00:03:53.635
safety.
00:03:54.330
C provides you with a tremendous amount
00:03:57.116
of control over the way data is
00:03:59.901
laid out in memory, with tremendous amount
00:04:02.687
of control over representations, and pointer use,
00:04:05.473
and so on, but in a way
00:04:08.258
that's quite unsafe, and quite hard to
00:04:11.044
get right.
00:04:11.940
More modern languages,
00:04:14.640
Rust being the example we’re using in
00:04:17.634
this course, but certainly not the only
00:04:20.629
language in the space,
00:04:22.440
provide
00:04:24.840
this type of behaviour in a much
00:04:27.828
safer way. They give you control over
00:04:30.816
data layout,
00:04:31.770
but they also provide memory safety,
00:04:34.361
they check it array bounds they check
00:04:37.383
pointers are used correctly, and they can
00:04:40.406
avoid problems like use-after-free bugs, data races,
00:04:43.428
iterator invalidation, and so on, and get
00:04:46.450
the control over data layout whilst maintaining
00:04:49.473
a lot more safety,
00:04:51.300
a lot more robust behaviours.
00:04:56.580
I think it's clear that concurrency is
00:05:01.243
important, especially as Moore's law and Dennard
00:05:05.905
scaling break down, and we get increasingly
00:05:10.568
concurrent systems.
00:05:12.000
And we spoke about several different approaches
00:05:15.052
to concurrency, but I think it's clear
00:05:18.105
they've all got trade-offs, and none of
00:05:21.157
them are a one size fits all
00:05:24.210
approach to building concurrent systems.
00:05:26.490
The transactional memory approach, I think,
00:05:29.625
works wonderfully in Haskell, but it's not
00:05:33.283
clear it scales out to other languages.
00:05:36.940
The message passing approach works wonderfully in
00:05:40.598
Erlang,
00:05:41.220
but fits less well, less naturally,
00:05:44.580
into many other languages, and has some
00:05:48.500
difficult safety issues in some cases.
00:05:51.960
And the asynchronous coroutine based approach
00:05:55.920
leads to strange behaviours with starvation and
00:05:59.652
blocking. There’s constraints, and it’s not clear
00:06:03.384
we have the right answer.
00:06:06.150
And we’ve shown that type systems,
00:06:07.816
I think, can help model the problem
00:06:09.760
domain. I think that's one of the
00:06:11.705
key takeaways.
00:06:12.360
We can model the assumptions, we can
00:06:16.457
help ensure the system is safe and
00:06:20.555
correct.
00:06:21.240
And we can make the systems much
00:06:23.798
safer, and avoid a lot of common
00:06:26.356
problems, by encoding more information into the
00:06:28.915
types, and letting the compiler help us
00:06:31.473
check the systems for correctness.
00:06:37.200
So that's where we are at today.
00:06:39.562
That, I think, is the current state-of-the-art,
00:06:41.925
and what we have learned from building
00:06:44.288
systems programs today.
00:06:47.340
Where we going in the future?
00:06:51.030
Well, as I mentioned, I think we
00:06:54.063
still don't have good solutions for concurrent
00:06:57.097
programming.
00:06:57.630
Transactional memory, I think, is very promising,
00:07:01.400
but doesn't fit well with impure imperative
00:07:05.171
languages, and most of the programs we
00:07:08.941
write today are written in impure imperative
00:07:12.711
languages.
00:07:13.350
Message passing is quite a natural approach,
00:07:18.720
and fits nicely into mainstream languages,
00:07:23.190
and solves some of the problems with
00:07:26.220
shared mutable state, and threads and locks,
00:07:29.599
but it's got problems with providing back
00:07:32.979
pressure, it can have race conditions and
00:07:36.358
deadlocks, and it's difficult to structure programs,
00:07:39.737
structure large message passing systems, without losing
00:07:43.116
track of the message flows.
00:07:45.630
And asynchronous code introduces subtle blocking and
00:07:50.709
starvation bucks.
00:07:52.260
And it's not really clear what's the
00:07:54.539
right solution.
00:07:55.290
It’s not clear if the problem domain
00:07:57.962
is sufficiently broad that we need different
00:08:00.635
types of solution for different problem domains,
00:08:03.307
and we are just going to end
00:08:05.980
up with three-or-four different ways of doing
00:08:08.652
concurrency, and you pick the appropriate one
00:08:11.325
for your domain.
00:08:12.570
Or if there's a more general solution
00:08:16.344
waiting to be discovered.
00:08:18.600
And I think none of these approaches
00:08:21.537
scale out to GPU programming, where you're
00:08:24.475
doing the same operation on 10s,
00:08:26.993
or 100s, of thousands of cores simultaneously.
00:08:30.030
And, maybe, there are approaches with implicit
00:08:33.028
parallelism. Maybe there are data parallel array
00:08:36.025
types that can solve this problem.
00:08:38.594
We haven't really spoken about GPU programming
00:08:41.592
in this course. But, again, there’s a
00:08:44.590
different type of concurrency, which again seems
00:08:47.587
to need different solutions.
00:08:54.090
It's not clear that we have good
00:08:57.590
approaches to making use of data centre
00:09:01.090
scale computing.
00:09:02.190
It’s not clear that we know how
00:09:04.589
to scale systems programming
00:09:06.060
to massive data centres, or to large
00:09:09.509
scale distributed edge compute
00:09:11.580
data centres.
00:09:13.800
It’s not clear that we know how
00:09:19.227
to do distributed computations across millions of
00:09:24.655
cores.
00:09:25.530
We do know how to build large-scale
00:09:29.515
Linux clusters, but we do this by
00:09:33.600
assuming a reliable, robust, homogeneous system.
00:09:37.477
And we do this by essentially automating
00:09:42.001
traditional systems administration.
00:09:44.040
We have DevOps tools, like Ansible,
00:09:47.785
and Salt Stack, and the like,
00:09:51.630
but all they’re doing is shell scripting
00:09:54.716
and editing config files.
00:09:56.580
It's the same type of approach,
00:09:58.824
just automating the ssh into a bunch
00:10:01.441
of machines and edit some config files.
00:10:04.059
And there has to be a better
00:10:06.677
way of doing that, a better way
00:10:09.294
of structuring the system.
00:10:10.890
And we know how to use these
00:10:13.374
data centres, but we know how to
00:10:15.857
use them to run millions of instances
00:10:18.341
of the same thing.
00:10:19.860
It's not clear that we are good
00:10:24.471
at
00:10:25.230
distributing code into these environments.
00:10:31.050
We can make it work
00:10:33.420
for restricted tasks and in homogenous data
00:10:37.795
centres.
00:10:38.520
But as compute becomes more ubiquitous,
00:10:40.628
as it moves out of the controlled
00:10:43.088
data centre and towards the edges of
00:10:45.547
the network,
00:10:46.350
where we need to run millions of
00:10:48.863
tasks over a ubiquitous computing environments that
00:10:51.376
spreads around the world, and is much
00:10:53.889
more heterogeneous, and much more variable,
00:10:56.043
in its configuration, it's not clear we
00:10:58.556
know how to do that that.
00:11:00.710
It’s not clear we have good approaches
00:11:03.223
to doing that.
00:11:09.360
It’s not clear that we necessarily have
00:11:13.272
the right operating systems abstraction for data
00:11:17.184
centres, or for
00:11:18.960
ubiquitous computing, edge computing, environments.
00:11:23.460
But I think are some interesting ideas
00:11:27.212
in this space.
00:11:28.920
The system known as BarrelFish, for example,
00:11:33.180
and the paper on the slide talks
00:11:35.926
about this,
00:11:36.810
has a goal of building a message-passing
00:11:40.825
operating system kernel for multi core systems.
00:11:44.940
And the idea here, is if you
00:11:47.542
have a system with multiple processors in
00:11:50.144
it, each processor core runs its own
00:11:52.746
instance of the operating system, and they
00:11:55.348
communicate with each other via message passing.
00:11:58.050
And there's no use of shared memory,
00:12:00.594
other than to implement the message passing
00:12:03.138
system as an optimisation, and there's no
00:12:05.682
main CPU in a system to act
00:12:08.226
as a central coordinator.
00:12:09.780
So if you have a quad core
00:12:13.470
phone, for example, then each of the
00:12:16.674
cores on the phone would be running
00:12:19.878
a separate instance of this operating system,
00:12:23.082
communicating internally via message passing.
00:12:25.470
And it's taking message passing as the
00:12:28.432
fundamental primitive. It's taking this idea to
00:12:31.393
its extreme, to separate every CPU into
00:12:34.355
its own message passing core.
00:12:36.570
And it's very much a research prototype,
00:12:38.972
to test an idea. It's not something
00:12:41.375
that you could currently make a robust
00:12:43.777
product out. But I think it's an
00:12:46.179
interesting approach, and I think it leads
00:12:48.582
to an interesting discussion about what's the
00:12:50.984
boundary of an operating system?
00:12:52.800
What's the distinction between a distributed multi-kernel,
00:12:56.480
multiple operating system kernels running on a
00:13:00.161
single machine exchanging messages with threads,
00:13:03.315
and one running across the network?
00:13:06.570
And should there, or does there even
00:13:10.264
need to be, such an assumption,
00:13:13.530
such a distinction?
00:13:17.040
Can we just run this type of
00:13:20.102
multi kernel across a data centre,
00:13:22.727
across an edge computing environment, for example?
00:13:25.890
Where are the boundaries between systems? And
00:13:28.750
what should be the boundary between systems?
00:13:31.710
So I think there's a bunch of
00:13:33.628
interesting questions in this space, that have
00:13:35.546
not yet been fully explored. And I
00:13:37.464
hope we’ll see some innovation in the
00:13:39.382
way we build operating systems going forward.
00:13:46.380
And we're increasingly seeing innovation in programming
00:13:50.687
languages. We spent a long time stuck
00:13:54.993
with C and C++, as a sort
00:13:59.300
of local
00:14:00.630
maxima.
00:14:02.730
But we're starting to see more research
00:14:07.029
ideas coming into mainstream languages.
00:14:10.200
And in Rust, as we've spoken about
00:14:13.207
in most of this course, and in
00:14:16.214
Swift, we're beginning to see abstraction,
00:14:18.792
and resource management, and
00:14:20.610
more expressive type systems, coupled with low-level
00:14:26.597
control, giving more powerful, safer, low-level programming
00:14:32.585
environments.
00:14:33.540
And languages like Erlang and Go,
00:14:36.101
are exploring the concurrency and fault tolerance
00:14:39.088
and communication space. And there are others
00:14:42.075
which are bubbling up, and people are
00:14:45.063
starting to explore how things can work.
00:14:48.150
And I think it’s long overdue that
00:14:51.844
we're seeing this development in the underlying
00:14:55.537
languages, and we're beginning to have more
00:14:59.231
expressive ways of describing what our program
00:15:02.925
should do.
00:15:04.080
We should clearly, I think, going forward
00:15:07.007
choose the language for our systems based
00:15:09.934
on the problem domain, based on the
00:15:12.861
tooling based, based on our expertise.
00:15:15.370
And it's not clear that single language
00:15:18.297
fits the entire space.
00:15:20.070
Rust, for example, works extraordinarily well for
00:15:24.305
building operating systems.
00:15:26.220
But languages like Erlang or Go are
00:15:31.235
possibly better suited to
00:15:34.200
large-scale web application development running in a
00:15:39.997
data centre, for example.
00:15:43.410
We've got good solutions for programming single
00:15:46.700
systems. I think Rust is great for
00:15:49.990
programming within a single system.
00:15:52.440
We're starting to learn about how to
00:15:54.653
scale to large clusters, to ubiquitous computing,
00:15:56.866
to edge computing environments, and I think
00:15:59.080
Erlang and Go are starting to have
00:16:01.293
some good ideas in this space,
00:16:03.190
but we don't have a language that
00:16:05.403
fills all of these spaces yet.
00:16:12.840
The systems we use, Unix and C,
00:16:16.962
made sense when we were programming simple
00:16:21.084
single core systems.
00:16:22.950
And they form on the basis of
00:16:26.455
pretty-much every computing system we use today.
00:16:30.060
But the system we see on the
00:16:33.621
left,
00:16:34.230
programmers at a PDP 10 with a
00:16:37.208
teletype, is not the data centre environment
00:16:40.185
we see on the right, where a
00:16:43.163
lot of modern software lives.
00:16:45.390
And I do think we need new
00:16:49.306
approaches to build software that is massively
00:16:53.222
concurrent and massively distributed.
00:16:55.560
Languages like Rust solve part of this
00:16:58.198
problem space, and give us low-level performance,
00:17:00.836
they give us an effective type system,
00:17:03.474
they give us abstractions for writing the
00:17:06.112
low-level code running on a single machine.
00:17:08.850
And that's essential, because no-one can hold
00:17:11.375
all those details in their head,
00:17:13.539
and we need this abstraction, we need
00:17:16.063
the compiler help to write this sort
00:17:18.588
of code correctly.
00:17:19.770
We need the tooling to check our
00:17:23.981
invariants, document our assumptions, ensure consistency.
00:17:27.690
But once we start scaling out to
00:17:30.340
data centres, and to the sort of
00:17:32.989
future ubiquitous computing, edge computing, world it
00:17:35.639
seems we are likely to get,
00:17:38.010
it's not clear that we have the
00:17:41.050
right DevOps, infrastructure as code, self-managing,
00:17:43.655
autonomic management systems, and the right approaches
00:17:46.695
for programming at such large scales.
00:17:55.020
And that is, essentially, all I want
00:17:57.571
to say.
00:18:00.900
The course, obviously, will have some assessment
00:18:04.757
at the end.
00:18:06.510
There will be a final exam,
00:18:09.141
worth 80% of the marks, which will
00:18:12.209
happen in the April/May time frame.
00:18:14.940
There is a sample exam paper,
00:18:17.705
with some worked answers, available on Moodle,
00:18:21.030
to give you an idea for the
00:18:24.536
feel of the questions.
00:18:26.640
The idea is very much to test
00:18:30.295
your understanding, rather than testing your memory.
00:18:34.050
Especially with the type of open-book exam,
00:18:38.580
which it’s necessary to offer with online
00:18:41.130
assessment, there's no point asking questions that
00:18:43.679
you can just Google the answer for,
00:18:46.229
and you can just look up in
00:18:48.779
the notes. We're looking to test your
00:18:51.329
deeper understanding of the material.
00:18:53.250
So think read-over the material, watch the
00:18:56.457
lectures, look at the material from the
00:18:59.664
papers, and the labs, and so on,
00:19:02.871
and think about it, learn about and
00:19:06.078
understand the material deeply.
00:19:08.010
And look out for questions testing that
00:19:13.672
deeper understanding.
00:19:15.390
There’s no specific revision lecture scheduled,
00:19:18.045
but we do have the Teams chat
00:19:21.142
and email, if you have questions about
00:19:24.239
the material. And the marks for the
00:19:27.336
assessed coursework it will be available shortly,
00:19:30.433
and I'm sorry it's taken a while
00:19:33.530
to get to those.
00:19:37.710
To finish up,
00:19:39.630
if you're interested further in these topics,
00:19:42.670
if you're continuing to Level 5 and
00:19:45.709
are interested in doing an MSI project
00:19:48.749
in this space, please contact me,
00:19:51.355
send me email and we'll talk.
00:19:54.060
I’m very keen to work with motivated
00:19:57.140
students to develop
00:19:58.560
MSci projects looking at, perhaps, networking and
00:20:02.524
transport protocol APIs using some of these
00:20:06.488
modern languages and modern approaches.
00:20:09.420
I’m keen to look at kernel bypass
00:20:14.477
networking,
00:20:15.300
kernel and user space networking APIs that
00:20:18.767
avoid a lot of the overheads in
00:20:22.234
the current approaches.
00:20:23.820
I'm keen to look into systems programming
00:20:26.757
models for large-scale edge compute systems,
00:20:29.275
and try to understand how we should
00:20:32.213
best be developing and programming such systems.
00:20:35.250
So, if any of this is of
00:20:37.263
interest to you, and you're staying on
00:20:39.275
for Level 5 and looking for an
00:20:41.288
MSci project, then comes talk to me.
00:20:45.930
And that's it.
00:20:48.360
A final paper to highlight
00:20:52.920
some of the issues around systems programming,
00:20:56.468
which you will hopefully find interesting.
00:20:59.610
I hope you found some of the
00:21:02.361
material in the course interesting. Thank you
00:21:05.111
for your attention.
00:21:06.390
And if there are any further questions,
00:21:08.345
please do get in touch. Thank you.
Lecture 10 summarised the course content and briefly discussed future
directions for systems programming. It noted that there are still no
good, general purpose, solutions for concurrent programming, and
highlighted some issues with programming large scale systems in data
centres and edge computing environments.
Discussion will focus on future directions for systems programming,
and on summarising key points of the material from the course as a
whole.