Operating Systems course lecture on memory management in Rust.
Browser design from 1990s (one process) to 2000s (one process per tag) to 2010s and beyond (enough processes to efficiently use machine resources to provide good user experience).
malloc, free, double-free vulnerabilities
University of Virginia
cs4414: Operating Systems
http://rust-class.org
Explicit vs. Automatic Memory Management
Garbage Collection, Reference Counting
Rust ownership types
For embedded notes, see: http://rust-class.org/class9-pointers-in-rust.html
University of Virginia
cs4414: Operating Systems
http://rust-class.org
Explicit vs. Automatic Memory Management
Garbage Collection, Reference Counting
Rust ownership types
For embedded notes, see: http://rust-class.org/class9-pointers-in-rust.html
This talk exposes the reasons what Servo is and why it is necessary, its current status, future plans and details on the Rust programming language, which has a symbiotic relationship with Servo.
Kernel-Level Programming: Entering Ring NaughtDavid Evans
University of Virginia
cs4414: Operating Systems
http://rust-class.org
Leslie Lamport wins the Turing Award!
Hardware-Based Memory Isolation
Software-Based Memory Isolation
Kernel-Level Programming
Which came first, programming languages or operating systems?
Programming without other programs
Kernel development
IronKernel
For embedded notes, see:
http://rust-class.org/class-14-entering-ring-naught.html
Ruby is Awesome and Rust is Awesome and Building a Game in Both is AWESOMEJulien Fitzpatrick
Learning to program in Ruby was super fun, but I kept hearing people talk about typed languages that are so-called "closer to the metal," like Rust. It seemed intimidating, but I was curious! I built a small, text-based adventure game in both Ruby and Rust, side-by-side, so I could see what the differences and similarities were. I learned a lot, and now I'm here to share it all with you!
Type-Directed TDD in Rust: a case study using FizzBuzzFranklin Chen
An expressive static type system is one of the most joyful and powerful tools for prototyping, designing, and maintaining programs. In this performance-theatrical presentation, I will provide a taste of how to use types, in conjunction with tests, to drive iterative development of a particular program, the famous FizzBuzz problem. We will solve generalizations of this problem, changing and adding requirements, to illustrate the pleasures and benefits of "type thinking".
The Rust language will be used as the vehicle for this demonstration, but the techniques apply immediately to any industrial-strength statically typed language, such as Scala, Haskell, OCaml, F#, and most recently, Swift.
RUSTing is not a tutorial on the Rust programming language.
I decided to create the RUSTing series as a way to document and share programming idioms and techniques.
From time to time I’ll draw parallels with Haskell and Scala, having some familiarity with one of them is useful but not indispensable.
Video and slides synchronized, mp3 and slide download available at URL http://bit.ly/1mn7lIO.
Aaron Turon explains Rust's core notion of “ownership” and shows how Rust uses it to guarantee thread safety, amongst other things. He also talks about how Rust goes beyond addressing the pitfalls of C++ to do something even more exciting: unlock a new generation of systems programmers by providing a safe, high-level experience -- while never compromising on performance. Filmed at qconsf.com.
Aaron Turon manages the Rust team at Mozilla Research. His background is in low-level concurrency and programming language design.
cs4414: Class 4 (Dos a Cero)
How to share a processor among multiple programs - non-preemptive and preemptive multitasking.
Why Senators shouldn't play games on their mobile devices during classified hearings.
Notes: http://www.cs.virginia.edu/~evans/cs4414-fall2013/class4.html
University of Virginia
cs4414: Operating Systems
http://rust-class.org
Explicit Memory Management
4.3BSD
Morris Worm
fingerd code
NX bit
For embedded notes, see: http://rust-class.org/class-8-managing-memory.html
Linked Open Data is the most usable kind of Open Data. An example of a well integrated source of Linked Open Data on tourism and mobility is the Open Data Hub operated by NOI. We will use the SPARQL querying language, a W3C standard, to query the data and show how this differs from other access methods. The tour will start by querying the end point directly from the command line with tools, like curl. Then, one by one, well known data science software packages. like R and Pandas, will be used to directly work with these datasets, to perform statistical calculations and generating graphs from data.
In the final part, these software packages will be used to query data from other well known data sources, like Wikidata and DBpedia.
A short introduction to reproducible research, reproducibility with R, Docker, and all together for reproducible research using R and Docker containers. Includes demos of Rocker and containerit.
Bandwidth
History of the Internet
Midterm Questions
How to tell if its a hardware or software problem?
What makes the fan go?
Benchmarking
Cheating on Benchmarks
Web Benchmarks
Apache is very good!
This talk exposes the reasons what Servo is and why it is necessary, its current status, future plans and details on the Rust programming language, which has a symbiotic relationship with Servo.
Kernel-Level Programming: Entering Ring NaughtDavid Evans
University of Virginia
cs4414: Operating Systems
http://rust-class.org
Leslie Lamport wins the Turing Award!
Hardware-Based Memory Isolation
Software-Based Memory Isolation
Kernel-Level Programming
Which came first, programming languages or operating systems?
Programming without other programs
Kernel development
IronKernel
For embedded notes, see:
http://rust-class.org/class-14-entering-ring-naught.html
Ruby is Awesome and Rust is Awesome and Building a Game in Both is AWESOMEJulien Fitzpatrick
Learning to program in Ruby was super fun, but I kept hearing people talk about typed languages that are so-called "closer to the metal," like Rust. It seemed intimidating, but I was curious! I built a small, text-based adventure game in both Ruby and Rust, side-by-side, so I could see what the differences and similarities were. I learned a lot, and now I'm here to share it all with you!
Type-Directed TDD in Rust: a case study using FizzBuzzFranklin Chen
An expressive static type system is one of the most joyful and powerful tools for prototyping, designing, and maintaining programs. In this performance-theatrical presentation, I will provide a taste of how to use types, in conjunction with tests, to drive iterative development of a particular program, the famous FizzBuzz problem. We will solve generalizations of this problem, changing and adding requirements, to illustrate the pleasures and benefits of "type thinking".
The Rust language will be used as the vehicle for this demonstration, but the techniques apply immediately to any industrial-strength statically typed language, such as Scala, Haskell, OCaml, F#, and most recently, Swift.
RUSTing is not a tutorial on the Rust programming language.
I decided to create the RUSTing series as a way to document and share programming idioms and techniques.
From time to time I’ll draw parallels with Haskell and Scala, having some familiarity with one of them is useful but not indispensable.
Video and slides synchronized, mp3 and slide download available at URL http://bit.ly/1mn7lIO.
Aaron Turon explains Rust's core notion of “ownership” and shows how Rust uses it to guarantee thread safety, amongst other things. He also talks about how Rust goes beyond addressing the pitfalls of C++ to do something even more exciting: unlock a new generation of systems programmers by providing a safe, high-level experience -- while never compromising on performance. Filmed at qconsf.com.
Aaron Turon manages the Rust team at Mozilla Research. His background is in low-level concurrency and programming language design.
cs4414: Class 4 (Dos a Cero)
How to share a processor among multiple programs - non-preemptive and preemptive multitasking.
Why Senators shouldn't play games on their mobile devices during classified hearings.
Notes: http://www.cs.virginia.edu/~evans/cs4414-fall2013/class4.html
University of Virginia
cs4414: Operating Systems
http://rust-class.org
Explicit Memory Management
4.3BSD
Morris Worm
fingerd code
NX bit
For embedded notes, see: http://rust-class.org/class-8-managing-memory.html
Linked Open Data is the most usable kind of Open Data. An example of a well integrated source of Linked Open Data on tourism and mobility is the Open Data Hub operated by NOI. We will use the SPARQL querying language, a W3C standard, to query the data and show how this differs from other access methods. The tour will start by querying the end point directly from the command line with tools, like curl. Then, one by one, well known data science software packages. like R and Pandas, will be used to directly work with these datasets, to perform statistical calculations and generating graphs from data.
In the final part, these software packages will be used to query data from other well known data sources, like Wikidata and DBpedia.
A short introduction to reproducible research, reproducibility with R, Docker, and all together for reproducible research using R and Docker containers. Includes demos of Rocker and containerit.
Bandwidth
History of the Internet
Midterm Questions
How to tell if its a hardware or software problem?
What makes the fan go?
Benchmarking
Cheating on Benchmarks
Web Benchmarks
Apache is very good!
Lessons I Learned While Scaling to 5000 Puppet AgentsPuppet
Russ Johnson of StubHub talks about "Learning Lessons Scaling to 5000 Puppet Agents" at Puppet Camp San Francisco 2013. Find a Puppet Camp near you: puppetlabs.com/community/puppet-camp/
Research @ RELEASeD (presented at SATTOSE2013)kim.mens
An overview of recent research results and directions at Prof. Kim Mens's RELEASeD research lab. Presented in July 2013 at SATTOSE2013 in Bern, Switzerland.
There is often a vocabulary gap between designers an developers, who should aim towards a ubiquitous way of conversing about colours, typography, viewport sizes, or the responsive grid system of a digital product… To bridge this gap at the Guardian, we use a CSS pre-processor as a communication enabler through the abstractions it allows us to put in place.
Talk given at re:revelop 2014 in Bournemouth on 22/08/2014: http://redevelop.io/
Continuous delivery model sounds great to almost everyone, but is not that easy to implement when real life comes into play. On the one hand, AEM architecture feels like a good fit for this strategy (everything is content after all, right?), but on the other hand we all know how challenging even individual deployment can get. Content management system itself is often just a fraction of your concern - you have to build it first, test it, stitch all the elements up and then figure out how to deliver your code in a repeatable and controlled way to production.
Throughout the last couple of years we’ve been trying really hard at Cognifide to make continuous release and delivery possible for AEM. It was a bumpy and twisty road, but we finally made it. During my talk I’d like to show you how we build AEM platforms these days using open source tools, including:
- Terraform to define and manage infrastructure as code
- Chef to describe deployments in an approachable way, which enforces consistency & repeatability across environments
- Consul that helps us discover services around and mitigate failures
- Jenkins & GoCD to orchestrate delivery model
Personal point of view on scikit-learn: past, present, and future.
This talks gives a bit of history, mentions exciting development, and a personal vision on the future.
Trick or Treat?: Bitcoin for Non-Believers, Cryptocurrencies for CypherpunksDavid Evans
David Evans
DC Area Crypto Day
Johns Hopkins University
30 October 2015
This (non-research) talk will start with a tutorial introduction to cryptocurrencies and how bitcoin works (and doesn’t work) today. We’ll touch on some of the legal, policy, and business aspects of bitcoin and discuss some potential research opportunities in cryptocurrencies.
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfPaige Cruz
Monitoring and observability aren’t traditionally found in software curriculums and many of us cobble this knowledge together from whatever vendor or ecosystem we were first introduced to and whatever is a part of your current company’s observability stack.
While the dev and ops silo continues to crumble….many organizations still relegate monitoring & observability as the purview of ops, infra and SRE teams. This is a mistake - achieving a highly observable system requires collaboration up and down the stack.
I, a former op, would like to extend an invitation to all application developers to join the observability party will share these foundational concepts to build on:
Climate Impact of Software Testing at Nordic Testing DaysKari Kakkonen
My slides at Nordic Testing Days 6.6.2024
Climate impact / sustainability of software testing discussed on the talk. ICT and testing must carry their part of global responsibility to help with the climat warming. We can minimize the carbon footprint but we can also have a carbon handprint, a positive impact on the climate. Quality characteristics can be added with sustainability, and then measured continuously. Test environments can be used less, and in smaller scale and on demand. Test techniques can be used in optimizing or minimizing number of tests. Test automation can be used to speed up testing.
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofsAlex Pruden
This paper presents Reef, a system for generating publicly verifiable succinct non-interactive zero-knowledge proofs that a committed document matches or does not match a regular expression. We describe applications such as proving the strength of passwords, the provenance of email despite redactions, the validity of oblivious DNS queries, and the existence of mutations in DNA. Reef supports the Perl Compatible Regular Expression syntax, including wildcards, alternation, ranges, capture groups, Kleene star, negations, and lookarounds. Reef introduces a new type of automata, Skipping Alternating Finite Automata (SAFA), that skips irrelevant parts of a document when producing proofs without undermining soundness, and instantiates SAFA with a lookup argument. Our experimental evaluation confirms that Reef can generate proofs for documents with 32M characters; the proofs are small and cheap to verify (under a second).
Paper: https://eprint.iacr.org/2023/1886
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfPeter Spielvogel
Building better applications for business users with SAP Fiori.
• What is SAP Fiori and why it matters to you
• How a better user experience drives measurable business benefits
• How to get started with SAP Fiori today
• How SAP Fiori elements accelerates application development
• How SAP Build Code includes SAP Fiori tools and other generative artificial intelligence capabilities
• How SAP Fiori paves the way for using AI in SAP apps
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
The Metaverse and AI: how can decision-makers harness the Metaverse for their...Jen Stirrup
The Metaverse is popularized in science fiction, and now it is becoming closer to being a part of our daily lives through the use of social media and shopping companies. How can businesses survive in a world where Artificial Intelligence is becoming the present as well as the future of technology, and how does the Metaverse fit into business strategy when futurist ideas are developing into reality at accelerated rates? How do we do this when our data isn't up to scratch? How can we move towards success with our data so we are set up for the Metaverse when it arrives?
How can you help your company evolve, adapt, and succeed using Artificial Intelligence and the Metaverse to stay ahead of the competition? What are the potential issues, complications, and benefits that these technologies could bring to us and our organizations? In this session, Jen Stirrup will explain how to start thinking about these technologies as an organisation.
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
Removing Uninteresting Bytes in Software FuzzingAftab Hussain
Imagine a world where software fuzzing, the process of mutating bytes in test seeds to uncover hidden and erroneous program behaviors, becomes faster and more effective. A lot depends on the initial seeds, which can significantly dictate the trajectory of a fuzzing campaign, particularly in terms of how long it takes to uncover interesting behaviour in your code. We introduce DIAR, a technique designed to speedup fuzzing campaigns by pinpointing and eliminating those uninteresting bytes in the seeds. Picture this: instead of wasting valuable resources on meaningless mutations in large, bloated seeds, DIAR removes the unnecessary bytes, streamlining the entire process.
In this work, we equipped AFL, a popular fuzzer, with DIAR and examined two critical Linux libraries -- Libxml's xmllint, a tool for parsing xml documents, and Binutil's readelf, an essential debugging and security analysis command-line tool used to display detailed information about ELF (Executable and Linkable Format). Our preliminary results show that AFL+DIAR does not only discover new paths more quickly but also achieves higher coverage overall. This work thus showcases how starting with lean and optimized seeds can lead to faster, more comprehensive fuzzing campaigns -- and DIAR helps you find such seeds.
- These are slides of the talk given at IEEE International Conference on Software Testing Verification and Validation Workshop, ICSTW 2022.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
2. Plan for Today
Some early comments on PS2 (how many
processes?)
Explicit vs. implicit memory management
Pointers in Rust
21 September 2013 University of Virginia cs4414 1
Notes for today will be posted later today.
4. How many processes should a
browser create?
21 September 2013 University of Virginia cs4414 3
New challenge for Exercise 1 & 2: what is the fewest number of processes you can
have running on your machine?
5. 21 September 2013 University of Virginia cs4414 4
1990’s answer:
1 process since
processes waste
memory and CPU
which are expensive
and limited
6. 21 September 2013 University of Virginia cs4414 5
2000s answer:
http://www.google.com/googlebooks/chrome/
9. 21 September 2013 University of Virginia cs4414 8
“Start from Scratch” = start from scratch
constrained by using programming tools
and methods developed in the 1960s
10. What should the 2010s answer be?
21 September 2013 University of Virginia cs4414 9
11. 21 September 2013 University of Virginia cs4414 10
Only two colors, but 4-8 cores!
(+ loads of GPU cores)
Samsung Galaxy S4
Apple iPhone 5C
Five colors, 2 cores!
Note: the colors vs. cores tradeoff can probably be overcome by good engineering,
but addressing the energy vs. cores tradeoffs require some theoretical advances also.
12. 21 September 2013 University of Virginia cs4414 11
Humans should not
be getting bored and
grumpy waiting for
their browser to
render a page while
cores are sitting idle!
13. 21 September 2013 University of Virginia cs4414 12
“Start from Scratch” = start from scratch
constrained by using programming tools
and methods developed in the 1960s
14. 2010s answer:
21 September 2013 University of Virginia cs4414 13
A modern browser should have enough
processes to efficiently use all the machine
resources available to provide human users
with a good browsing experience!
Unfortunately, it is not
(humanly) possible to build such
a browser (in a way that will
also be secure, robust, and
reliable) using languages whose
primary design goal was to fit
on a 4K machine.
15. 21 September 2013 University of Virginia cs4414 14
Why do our
Rust stickers
have a gear
on them?
Servo: the main reason
Rust is being developed is
so Mozilla can build a
better browser!
16. 21 September 2013 University of Virginia cs4414 15
Really starting from
scratch is really hard…
this is why getting
Servo to the point
where it can render a
static page is cake-
worthy!
17. What Dave was doing when you
were learning to crawl…
21 September 2013 University of Virginia cs4414 16
18. 21 September 2013 University of Virginia cs4414 17
ACM Foundations in Software Engineering, 1994
19. 21 September 2013 University of Virginia cs4414 18
comp.os.linux post, August 1994
20. $ man malloc # on my Macbook Air
MALLOC(3) BSD Library Functions Manual
SYNOPSIS
...
void free(void *ptr);
void *malloc(size_t size);
...
DESCRIPTION
The malloc(), calloc(), valloc(), realloc(), and reallocf() functions
allocate memory. The allocated memory is aligned such that it can
be used for any data type, …. The free() function frees allocations
that were created via the preceding allocation functions.
The malloc() function allocates size bytes of memory and returns a
pointer to the allocated memory.
MemorymanagementinC
21 September 2013 University of Virginia cs4414 19
21. 21 September 2013 University of Virginia cs4414 20
# include <stdlib.h>
# include <stdio.h>
int main(int _argc, char **_argv) {
int *x = (int *) malloc (sizeof(*x));
*x = 4414;
printf("x = %dn", *x);
return 0;
}
gash> gcc -Wall toofree.c
gash> ./a.out
x = 4414
22. 21 September 2013 University of Virginia cs4414 21
# include <stdlib.h>
# include <stdio.h>
int main(int _argc, char **_argv) {
int *x = (int *) malloc (sizeof(*x));
*x = 4414;
free(x);
printf("x = %dn", *x);
return 0;
}
gash> gcc -Wall toofree.c
gash> ./a.out
x = 4414
23. 21 September 2013 University of Virginia cs4414 22
# include <stdlib.h>
# include <stdio.h>
int main(int _argc, char **_argv) {
int *x = (int *) malloc (sizeof(*x));
*x = 4414;
free(x);
free(x);
printf("x = %dn", *x);
return 0;
}
gash> gcc -Wall toofree.c
gash> ./a.out
a.out(23685) malloc: *** error for object 0x10a1008d0:
pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6
Note: this is what happens to
happen on my computer, but the C
behavior is undefined. It would be
“correct” for a C program like this
to do absolutely anything!
24. This gets
tricky…
21 September 2013 University of Virginia cs4414 23
(from locale.h)
struct lconv
{
char *decimal_point;
char *thousands_sep;
char *grouping;
char *int_curr_symbol;
char *currency_symbol;
… } ;
// in my code…
struct lconv *local = localeconv (void);
…
free(local->decimal_point); // ?
free(local); // ?
25. Should we really care?
21 September 2013 University of Virginia cs4414 24
November 2009
35. 21 September 2013 University of Virginia cs4414 34
Static Detection of Dynamic Memory Errors, David Evans, PLDI May 1996
36. 21 September 2013 University of Virginia cs4414 35
Static Detection of Dynamic Memory Errors, David Evans, PLDI May 1996
37. 21 September 2013 University of Virginia cs4414 36
Note: these are “compile-time” errors (just produced by a separate tool).
Static Detection of Dynamic Memory Errors, David Evans, PLDI May 1996
38. 21 September 2013 University of Virginia cs4414 37
Annotations?
Where we are going,
we don’t need
annotations!
39. 21 September 2013 University of Virginia cs4414 38
A box is a reference to a heap allocation holding another value.
There are two kinds of boxes: managed boxes and owned boxes.
An owned box type or value is constructed by the prefix tilde sigil ~.
Rust Manual, Section 9.1.4
extern /*@only@*/ char *gname;
void setName(/*@temp@*/ char *pname) {
gname = pname;
}
40. 21 September 2013 University of Virginia cs4414 39
A box is a reference to a heap allocation holding another value.
There are two kinds of boxes: managed boxes and owned boxes.
An owned box type or value is constructed by the prefix tilde sigil ~.
Rust Manual, Section 9.1.4
extern /*@only@*/ char *gname;
void setName(/*@temp@*/ char *pname) {
gname = pname;
}
static gname : ~str = ~"";
fn set_name(pname : &str) {
gname = pname;
}
*Note: we can’t really have a global, owned string like this in Rust.+
41. 21 September 2013 University of Virginia cs4414 40
extern /*@only@*/ char *gname;
void setName(/*@temp@*/ char *pname) {
gname = pname;
}
gash> splint sample.c
sample.c:5: Only storage gname not released before assignment:
gname = pname
sample.c:1: Storage gname becomes only
sample.c:5: Temp storage pname assigned to only: gname = pname
sample.c:3: Storage pname becomes temp
static gname : ~str = ~"Where we're going, we don't need roads!”;
fn set_name(pname : &str) {
gname = pname;
}
gash> rustc sample.rs
sample.rs:4:12: 4:17 error: mismatched types: expected `~str` but found `&str`
(str storage differs: expected ~ but found &)
sample.rs:4 gname = pname;
42. 21 September 2013 University of Virginia cs4414 41
static gname : ~str = ~"annotations";
fn set_name(pname : ~str) {
gname = pname;
}
fn main() {
set_name("roads");
}
gash> rustc sample2.rs
sample2.rs:8:13: 8:20 error: mismatched types: expected
`~str` but found `&'static str` (str storage differs: expected ~
but found &'static )
sample2.rs:8 set_name("roads");
43. 21 September 2013 University of Virginia cs4414 42
fn set_name(gname : &mut ~str, pname : ~str) {
*gname = pname;
}
fn main() {
let mut gname : ~str = ~"annotations";
println(fmt!("gname = %s", gname));
set_name(&mut gname, ~"frees");
println(fmt!("gname = %s", gname));
}
gash> rust run good.rs
gname = annotations
gname = frees
44. 21 September 2013 University of Virginia cs4414 43
Why doesn’t Rust complain about the missing free?
fn set_name(gname : &mut ~str, pname : ~str) {
*gname = pname;
}
45. 21 September 2013 University of Virginia cs4414 44
Free()s?
Where we are going,
we don’t need free()s!
46. 21 September 2013 University of Virginia cs4414 45
PS2 is due Monday Sept 30.
You can use any language you want for this, but if
your submission has any double-free vulnerabilities,
buffer overflow vulnerabilities, or memory leaks you
get a -10 on this assignment.
Managing memory safely and explicitly gets really
complicated since we often do want to share
objects. We’ll talk about pointer types Rust
provides for more complex sharing next class.
47. Charge
Next class: complexities of memory
management
PS2 is due Monday, 30 September
21 September 2013 University of Virginia cs4414 46
https://botbot.me/mozilla/rust/