Summary Computer Science CSC2002S | Notes covering the entire course
27 views 1 purchase
Course
Computer Science 2002 (CSC2002S)
Institution
University Of Cape Town (UCT)
These notes cover all content covered in the course - 1. Parallel + concurrent computing. 2. Architecture. 3. Mobile design and development. These notes are in Word format to allow you to edit and add content that may be added. These notes allowed me to achieve above 70% in both theory tests and a ...
1. Parallel and Concurrent Programming ................................................................................. 2
2. Architecture ................................................................................................................................. 84
3. Mobile Development and Design ...................................................................................... 181
,1. Parallel and Concurrent Programming
Parallelism versus Concurrency
Parallel program:
• Use extra computational resources to solve a problem faster (increasing
throughput via simultaneous execution).
Parallel algorithm example:
• May get roughly 4x speedup – array sum
Concurrent program:
• Correctly and efficiently manage access to shared resources (from multiple
possibly-simultaneous clients).
• Uses synchronization to prevent multiple operations from interleaving in a
way that leads to incorrect results
,Concurrency algorithm example:
• Prevent bad interleaving (correctness).
• But allow some concurrent access (performance).
Checkpoint
Your Java web server needs to keep track of the number of accesses to particular
web pages. As defined in this course, this is a:
A. parallel programming problem
B. concurrent programming problem
C. Both A and B
D. neither A nor B
→C
Concurrency Problems – Race Conditions
• A race condition is an error in a program where the output and/or result of
the process is unexpectedly and critically dependent on the relative sequence
or timing of other events.
• The idea is that the events race each other to influence the output first.
NOTE: Unintended race conditions are incredibly common in concurrent programs.
Example:
Therac-25, a radiation therapy machine for cancer treatment used software safety
systems that had a race condition between operator text input and software
configuring the electron beam. Caused by users hitting the up arrow too quickly,
preventing the system from properly registering their edits.
→ Resulted in an occasional 100X radiation dose, that lead to several deaths.
, Nondeterminism
In sequential programs, instructions are executed in a fixed order determined by the
program and its input. The execution of one procedure does not overlap in time with
another.
→ Deterministic
In concurrent programs, computational activities may overlap in time and the
subprogram executions describing these activities proceed concurrently.
→ Non-deterministic
NOTE: It is not possible to tell, by looking at the program, what will happen when it
executes.
Parallel/Concurrent Complexity
Managing parallel complexity and the principles and techniques necessary for the
construction of well-behaved and efficient parallel and concurrent programs.
NOTE: General rule is to stay sequential if possible.
When parallel programming is necessary
High Performance Computing (HPC):
• Uses cutting-edge parallel computers to solve “grand-challenge” problems.
• Programmers write programs to solve such computationally large problems
that it would take years, or centuries, for one computer to finish it.
NOTE: Parallel programming is essential to use the computing power of multicore
architectures → Most current desktop and laptop computers have multiple cores.
When concurrent programming is necessary
Complex programs like:
• Operating systems, web browsers, real-time systems, event-based
implementations of graphical user interfaces, multiuser games, chats and
ecommerce.
• Handle multiple things happening at once and therefore are multithreaded.
• Many concurrent threads run simultaneously.
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller joshbirkholtz. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $4.38. You're not tied to anything after your purchase.