Module 2: Computer Hardware and OS
Overview
Computer hardware refers to the physical components that make up a computer system. These components work together to process, store, and transmit data, enabling the computer to function.
In this module, we'll explore the major hardware components, their roles, and how they interact with the operating system to create a functioning computer system.
Learning Objectives
- Recall that computers internally represent all data and applications as binary
- Convert between different data size units (byte, kilobyte, megabyte, gigabyte)
- Recall that a computer's central processing unit (CPU) executes instructions
- Recall that a computer’s random access memory (RAM) is capable of fast, but temporary data storage and retrieval
- Recall that an operating system is capable of executing multiple processes concurrently
- Recall that operating systems provide abstractions for processes to perform I/O with hardware
- Recall that the file system is responsible for persistent data storage and retrieval.
- Recall that a process does not execute while waiting for I/O.
- Recall that multi-core processors can execute multiple processes simultaneously
- Analyze if a software system is CPU, I/O, or memory bound given observations of its performance
- Explain when a software system would be CPU bound
- Explain when a software system would be I/O bound
- Explain when a software system would be memory bound
- Explain how to improve performance of a software system given that it is CPU, I/O, or memory bound
Introduction to Computer Hardware
In this lesson, you'll learn the basics about computer hardware and operating systems. As you move through this lesson, pay attention to the individual pieces that make up the computer as well as how these elements interact with each other. You might imagine the computer as an ecosystem in which each part plays an important role. As Figure 1 illustrates, in natural ecosystems, there is a constant flow between elements within the ecosystem, as resources are passed back and forth. Similarly, there is a near-constant flow of input and output across the different elements of a computer. The components we learn about in this lesson (the CPU, the operating system, RAM, the file system, and I/O) all have an important role to play in your computer's ecosystem.

Figure 1: In a biological ecosystem, all parts play a role in the functioning of the environment, each part taking some resources and providing other resources. This can be a helpful metaphor to think about how the components of a computer interact.
Under the hood: How computers work
What we see vs what the computer sees
Before tackling the various hardware elements that comprise a computer, we'll examine the difference between what we see and what the computer sees. To do this, we'll briefly explore binary and how data sizes are determined.
What is binary?
Binary is what's called a "base 2" number system. The name "base 2" isn't particularly important, but it does help explain what binary is: a number system with only two symbols. Let's compare this to the base 10 number system we normally use. A base 10 system uses ten symbols to represent numbers (0, 1, 2, 3, 4, 5, 6, 7, 8, and 9). All of the numbers you can think of make use of some combination of those ten symbols. Ten, for example, is a combination of 1 and 0.
While we are used to the base 10 system, computers use binary, which is most often represented as a series of ones and zeros. As the following table shows, all integers and letters can be represented by a sequence of zeros and ones in binary. As you can see by looking at the alphabet letters, binary is not easy for humans to recognize meaningfully.
Numbers | Numbers in Binary | Letters | Letters in Binary |
---|---|---|---|
0 | 0 | A | 01000001 |
1 | 1 | B | 01000010 |
2 | 10 | C | 01000011 |
3 | 11 | D | 01000100 |
4 | 100 | E | 01000101 |
5 | 101 | F | 01000110 |
Optional: If you would like to learn more about how to translate base-10 numbers into base-2 you can check out this online resource. If you want to write your friends notes in binary, and need to translate characters into binary you can check out this online resource.
High-level languages vs. binary
Programming languages are classified into three categories: High-level languages, low-level languages, and machine language. Java is a high-level language. High-level languages are designed to be easier for humans to read, understand, and code. Think about the keyword "return" in Java. Return is a common word, and its meaning in Java is fairly similar to its meaning in daily use (to give back). It's not too important to worry about low-level languages, but as you'll see in Figure 2, they are an intermediary step between a high-level language like Java and machine language. In other words, they are not as straightforward to scan and read as a high-level language, but they still employ some recognizable keywords.
Finally, we have machine language, which is binary. Computers only read machine language. This means that all programming languages, from Python to Java, must be translated into binary for computers to both understand and respond.

Figure 2: High-level programming languages like Java contain familiar keywords that help human developers read and write them. Low-level programming languages contain fewer keywords but are still easier for developers to read. The computer only understands binary, the executable machine code.
Binary and bytes
You may be wondering why binary matters? Well, understanding that the computer only "sees" binary is important for understanding file sizes. Because the computer communicates in binary, the smallest possible unit of data is a bit, which is a zero or a one. As we saw in Figure 1.1, however, a single bit is so small it's not even enough to communicate a single letter. So, it's more practical to think about a byte, which is eight bits. Why eight? Well, if you glance back to Figure 1.1, you'll notice that the letters in binary are all eight digits long. A byte is enough information to store a single character, like a letter.
You may already be familiar with larger units of measure for digital storage. When new smartphones are released, manufactures often flaunt the storage capacity, and if you have ever shopped for a computer you may have thought about what size hard drive you need. It's worth remembering that humans count in a "base 10" number system (we use ten digits to represent numbers), while computers use binary. As you can see in Figure 3, this means that a kilobyte is actually 1024 bytes, instead of the 1000 you might expect kilo to represent in base 10.

Figure 3: Each size increment is 1024 units larger than the size below it. This allows us to talk about very large file sizes accurately without using incredibly large numbers.
As Figure 3 shows, each unit of measurement is bigger than the previous unit by 1024. For this unit, you should make note of the order: byte, kilobyte, megabyte, gigabyte, and terabyte.
To get some sense of how big each file size is, let's think about some common files and their relative sizes. A very short email message is about 1kB, while a longer email message could perhaps go up to 3-4 kB. A four-minute song is about 3.5 MB. A Blu-ray movie file is approximately 20 GB, depending on the length of the movie. Converting these file sizes into kilobytes shows just how much bigger each file size is.
To find out how big our song is in kilobytes we multiply 3.5 by 1024 (because each single megabyte is 1024 kilobytes). The song is 3584 kilobytes. Converting our Blu-ray movie from gigabytes to kilobytes will take an extra step, as we must first convert it into megabytes. We multiply 20 by 1024 to get 20480, the size of our movie in megabytes, and then multiple 20480 by 1024 to get 20,971,520.
To get a better sense of how big each of these file sizes are, the below table shows a megabyte, gigabyte and terabyte and its equivalent size in kilobytes:
Size | Size in kilobytes (KB) |
---|---|
1 megabyte (MB) | 1024 KB |
1 gigabyte (GB) | 1,048,575 KB |
1 terabyte (TB) | 1,073,742,180 KB |
Computer components
Now that we've covered what the computer sees and its units of measurement, we'll look at the essential components of a computer: the CPU, the operating system, RAM, and the file system. As mentioned in the introduction to this reading, you can think of a computer as an ecosystem, with each component playing a specific role and communicating with other components in important ways.
The CPU
The CPU is the central processing unit in a computer and is sometimes referred to as simply the processor, however, there are many processors in modern computers. Every single operation performed by your computer is handled in the CPU. For each operation, the CPU will complete four main tasks:
- Fetch: the CPU receives instructions about operations to perform
- Decode: the CPU converts instructions into proper formats needed to continue the operation
- Execute: the CPU performs the requested operation
- Store: the CPU writes the result of the operation to memory, providing feedback on the operation
So how does a CPU relate to other elements of a computer? In short, the CPU is constantly receiving requests (fetching) from the operating system, decoding and executing the requested operations, and storing the results of the operation in RAM. The CPU also reads information in from the file system and writes to it as needed.
Multi-core processors
Most modern systems contain multi-core CPUs; CPUs with more than one independent core processor. Since we now know that every process must pass through the CPU, you may be able to guess the value of a multi-core processor already. They can handle multiple processes simultaneously making them more efficient. Programs running on a computer are often called processes.
Operating systems and I/O
While it may not seem like a flashy program, the operating system (OS) is the most important program on any computer. Whether computer users are aware of it or not, they interact with their operating system every time they use their computer. You can think of an operating system as part translator and part manager for your computer. As translator, the operating system takes in all kinds of input from users and applications and translates it into a format that the CPU can understand. It also translates all output back to the appropriate format. As manager, the operating system makes decisions about how and in what order to send requests to the CPU from all the various applications and other forms of input a computer receives. Every application or program on a computer sends its requests to the operating system to handle.
One of the important decisions an operating system must make is determining which processes should be given priority. Priority impacts when a request is sent to the CPU and how much space in RAM a process is given (RAM will be explained more fully below). Some processes are the programs a user is actively using, such as an internet browser or a word processor. However, there are many processes that run in the background while a user is working on a computer. These background processes run behind the scenes and don't require input from users. Background processes include things like system monitoring and user notification systems. The operating system handles all of these processes concurrently (at the same time) and, under normal working conditions, responds to the user without interruption as it handles these background operations.
Not only does your operating system need to manage each process running on your computer, it also needs to act as a translator between you, networks you are connected to, and the CPU. As a user, you can send information to your computer and receive information back from your computer through I/O devices. I/O refers to input/output and is our means of communicating with a computer.
Input devices include the hardware you use to interact with the computer like the mouse and keyboard, but can also refer to things like a scanner, a touchpad, or any other device that sends signals to a computer. When you click a key on your keyboard, it sends a signal to the operating system. The operating system then determines what that input is intended to mean based on the process you are actively running; clicking a key such as the enter button might have different meanings depending on what program you are using. Once the operating system has interpreted your input, it translates it to a request for the CPU.
Output devices include things like monitors, printers, speakers, and anything that the computer uses to communicate information to a user. If you click the enter key when using a word processor, the output of that action (the response the CPU sends back to you) might be to move your cursor to a new line. In short, I/O refers to the communication environment of a computer. Why are we talking about I/O in a section about operating systems? Well, I/O is the way operating systems receive requests from users and communicate back to users about processes. The operating system acts as a translator, abstracting input from users and other sources into a usable format for hardware (turning the input into binary for the CPU, and turning the output from binary to the proper format).
Types of memory and storage: RAM and file systems
In the last section of this read, we'll look at the differences between volatile and non-volatile memory. The word volatile means able to change rapidly, which is a good description for memory that only retains its memory information while the computer is powered on. As soon as a computer is turned off, anything that was left in volatile memory is gone. To understand what this means, think about using a word processor. As you type in a document, you can see the words you previously typed. They are temporarily "stored". However, if you close your document without saving, or if your computer loses power as you are working, those words are gone! In contrast, non-volatile memory keeps its contents even after a computer is turned off or loses power. In our word processor example--- if you save the document you are working on, you can close the program and turn the computer off without losing your work. Your information persists through the computer losing power.
What is RAM?
Understanding the difference between volatile and non-volatile memory is important for understanding the differences between RAM and the file system. RAM stands for Random Access Memory. RAM is volatile memory where the computer stores information about processes on which it is currently working. Imagine you have a desk in an office. Throughout the day, your desk accumulates things: quick notes about projects you are working on, an important document you need to reference for a meeting, perhaps the agenda of a meeting, etc. At the end of the day, you clear your desk off, dumping all the scraps of paper that have accumulated into the trash so you can start again fresh tomorrow.
In this example, the worker is the operating system, adding information into RAM as it is needed. The operating system continuously cycles information in and out of RAM based on the requests a user makes and the needs of the CPU. RAM is great for quick, temporary storage. Like putting a sticky note on your desk, it takes the computer very little time to add something to RAM or find it again. However, again like your sticky note, RAM is not the ideal long-term storage solution.
It's important to understand that RAM is for short term use only. RAM is not used for any sort of long-term storage. Any information that needs to be retrieved later is not stored in RAM because it is volatile and its contents are lost when the computer is turned off or loses power. Programs themselves are not saved in RAM, and important program files should not be saved there either.
What is a file system?
If program files are not saved in RAM, you may be wondering how and where they are saved. Since users need long term and frequent access to program files, these files need to be saved in a non-volatile location. This is where the file system comes in. A file system is a part of the operating system that is used to save and organize files for non-volatile storage. The file system keeps track of everything that is on the hard disk (what computer users typically think of as the computer's memory) and organizes it for easy access and retrieval. The file system has two important roles. First, it determines how and where information will be stored on a computer. Second, the file system determines what types of additional information, or metadata, will additionally be stored. You may have noticed we identified the file system as a part of the operating system. This is important; file systems are operating system specific, and vary in functionality between Windows, Mac, and Linux. This is one reason you may see different file extensions on a Mac and Windows machine (.exe on Windows and .dmg on Mac, for example) and why file paths may look different between the two operating systems.
Let's take a quick look at the differences between RAM and the file system. As volatile memory, RAM stores data that is being actively worked on or requested by the operating system. It is not used for long-term storage of program files. In contrast, the file system organizes information for long-term storage, allocating space in directories and maintaining metadata (which might include something like the last time a file was accessed and which user accessed it). The following table gives you a quick reference to the different purposes of RAM and the file system.
Comparison of Memory and Storage Types
RAM | File System |
---|---|
Short-term, temporary storage | Long-term, stable storage |
Quickest access and retrieval | Slower access and retrieval |
Contents cleared when system shuts down | Contents preserved when system shuts down |
Conclusion
At the beginning of this lesson, we introduced the idea of the computer as an ecosystem. The CPU does the literal 'computing' work of a computer, but it only communicates in a language that is difficult for users to interpret. Acting as an intermediary, the operating system takes in input in user friendly ways, from keyboards to scanners, and it responds to users in similar user-friendly ways, from display monitors to printers. To complete the tasks of translating and managing, the operating system interacts with RAM for short-term notetaking and the file system for long term storage. Each piece of this hardware ecosystem is necessary for the proper functioning of a computer, and each piece completes a clearly defined set of functions. This lesson has explored how systems are supposed to work when all parts of the ecosystem are communicating well with each other. In the next lesson, we'll take a look at what happens when communication between these parts slows down.
Core Computer Hardware Components
Central Processing Unit (CPU)
The CPU is the brain of the computer, responsible for executing instructions and performing calculations. Modern CPUs contain multiple cores, allowing for parallel execution of tasks.
- Instruction Cycle: Fetch, decode, execute, store
- CPU Cache: L1, L2, and L3 caches provide fast access to frequently used data
- Clock Speed: Measured in GHz, indicates how many cycles per second
- Architecture: CISC vs. RISC design approaches
Memory (RAM)
Random Access Memory provides temporary, high-speed storage for data that the CPU needs to access quickly. RAM is volatile, meaning its contents are lost when power is turned off.
- Types: DDR4, DDR5, etc.
- Capacity: Measured in gigabytes (GB)
- Access Time: Typically measured in nanoseconds
- Role: Stores currently running programs and their working data
Storage (HDD/SSD)
These provide persistent storage for the operating system, applications, and user data.
- Hard Disk Drives (HDD): Magnetic storage, slower but more affordable for large capacities
- Solid State Drives (SSD): Flash memory-based storage, faster but more expensive
- NVMe: Interface protocol designed to accelerate the transfer of data between SSDs and a computer's CPU
- Access Times: Milliseconds (HDD) vs. microseconds (SSD)
Motherboard
The main circuit board that connects all components together, providing pathways for data transfer.
- Chipset: Controls communication between CPU, memory, and peripherals
- Bus: Pathway for data transfer between components
- Form Factors: ATX, Micro-ATX, Mini-ITX, etc.
- Expansion Slots: PCIe slots for graphics cards, network cards, etc.
Identifying and Resolving Basic Performance Issues
Understanding hardware-software interactions helps identify and resolve performance bottlenecks.
- I/O Bottlenecks: Slow disk access, network latency
- CPU Bottlenecks: Compute-intensive operations, inefficient algorithms
- Memory Bottlenecks: Insufficient RAM, excessive paging
- Optimization Techniques: Caching, parallel processing, asynchronous I/O
Overview
In the last reading we ran through how computers communicate both with the user and with different parts of its system. The descriptions of how the CPU, OS, and RAM communicate with each other demonstrated how each part interacts when all processes run smoothly. In this lesson, we'll look at where processes spend their time and how different components can cause bottlenecks in the execution. We'll talk about three specific ways a process can encounter a slowdown, and we will learn to identify why a process is running slowly as well as how to potentially speed it up.
Last lesson we discussed the CPU, RAM, and input/output devices (referred to simply as I/O for the rest of the lesson) as an interconnected system. We learned how processes, or programs, on your computer interact with each of these different systems. These processes can slow down if there is an issue communicating with any of them. When a process becomes limited by the speed of a resource it requires, we refer to the process as bound.
When things slow down: CPU-, I/O-, and memory-bound processes
A process, or application, can hit a bottleneck at many different points in its execution. In software engineering, a bottleneck occurs when an application's performance is limited by a single resource, like the neck of a bottle slowing down the overall water flow. The application is bound by that resource. In this lesson, we will look at the differences between a CPU-bound process, an I/O-bound process, and a memory-bound process. We'll also cover some basic ways to identify where a process has become bound and discuss strategies for improving bound processes' performance.
CPU-bound processes
In the last lesson, we introduced the role of the CPU as doing the actual "computing" in a computer. It follows then that a CPU-bound process is one that is limited by the speed and processing power of the CPU. These are processes that typically spend an excessive amount of time calculating or executing code. During this time, the CPU may be using nearly all of its processing power, from 90 -- 100%. Sometimes a process is only briefly CPU-bound. A word processor running spell check is a great example of this issue. While spell check is running, the processes' CPU usage will spike; it is nearly entirely consumed by running the spell check.
It is fairly straightforward to identify when a process becomes CPU-bound on a personal computer. Since CPU-bound means the process is being slowed down by the CPU, opening the Activity Monitor on your Mac while a process is running and looking at the performance information in the CPU pane will give you a clear picture of whether the process is CPU bound. (To locate the Activity Monitor, in the Finder click the Go menu and choose Utilities to find and open the Activity Monitor.) In Figure 1, you can see the CPU pane on the Activity Monitor with the usage for each process currently running, both actively and in the background. If one of these processes were to become CPU-bound, the usage for that process would be high.

Figure 1: The Activity Monitor showing the CPU utilization. Currently, WindowsServer is using the greatest amount, but overall utilization is low.
Later in this unit, we will discuss metrics that track CPU usage for the code you write and deploy, and learn about how we can view and analyze this data.
I/O bound processes
A process that is I/O bound is one that is waiting for input or output operations. To understand this, think again about a word processor. When you open a new document, the word processor is waiting for your input via the keyboard to display output to you, which are the words you typed. Processes don't run when they are actively waiting for input or output.
In the previous lesson we discussed I/O as a primarily user-based, local system. In other words, we used the examples of a mouse and keyboard as input and the monitor and speakers as output. However, computers also have network I/O. Network I/O refers to when the computer is communicating with another computer, receiving input and providing output to another system. If a process requires information from another server, it must request it with a network call, and it waits for the other server to respond. This can be another service that your code is calling or a database. During this waiting time your process is blocked, meaning it cannot continue until the response comes back. A lot of network calls can mean that your process is spending more time requesting and blocked waiting for data than it is processing it. This is an example of an I/O bound application. The problem can become even worse if the server your process is waiting on takes a long time to respond or never responds at all!
Identifying an I/O bound process involves a bit of an awareness about what your process is trying to do. Does your process require information from a network server, or is it spending time reading and writing from files? When this happens, your process stops and waits, so you'll experience a slowdown but won't see a spike in your CPU. Knowing that your processes require I/O and observing what else is happening on your system can help you identify that you should investigate the time spent performing I/O. Later in this unit we will discuss ways of collecting and reviewing metrics such as how long it takes for a round trip call to your database or a dependent service.
Memory bound processes
The final type of bound process we'll cover in this lesson is when a process becomes memory bound. RAM is essentially the notepad a computer actively uses during processes to store the information it needs to complete operations. If the speed of the process is limited due to the amount of available notepad space, needing notes to be erased before new ones can be made, your process is memory bound.
Imagine that in order to respond to a request, your code must do a calculation which requeires a large amount of data from your database. In order to complete this calculation, you need to query multiple tables and store the data in memory while you compute a response. The computer needs to hold the contents of the queries in RAM. Now, if your queries' responses were really large, it's possible that the data could entirely fill your available RAM attempting to process the request. Any intermediate objects created while doing the calculation can add additional strains on your memory usage.
To identify if your process is memory-bound locally, you can look again at the Activity Monitor. This time, instead of looking at the CPU pane, select the Memory pane as shown in Figure 2. If the memory usage is particularly high, your process may be memory-bound. It's important to remember that the CPU and RAM on your computer are shared by all processes. The operating system makes decisions about which processes have access to which resources and when, but if one process becomes either CPU or memory bound, it will slow down all other processes (due to the amount of CPU utilization and memory being used by the bound process). Furthermore, a process that is NOT bound when it is the only thing running on your system may become bound when you try to do something else on your system.

Figure 2: The Activity Monitor showing memory usage. kernel_task is currently using the most memory, but there is plenty of free memory in this image. You can see this by taking a look at the Memory Pressure section in the bottom left.
Later in this unit we will discuss metrics that tracks your code's memory usage, and we will learn how we can view and analyze this data.
Improving performance
Once you've identified where the bottleneck is in your process, you can begin to take steps to improve your process' performance. These steps will differ depending on the nature of the bound process. We will look at some steps to take for each problem type.
Correcting CPU-bound process
For a CPU-bound process, you want to find ways to minimize CPU utilization or run the process on a more powerful CPU. One simple way to improve performance on your personal computer might be to close other applications that are running. This will free up some room for your CPU to handle your process. If we're talking about code that you have written and deployed, one option would be to simplify the operations that are being run within your process. This is where the runtime of an algorithm can have its impacts. Refactoring code that uses an algorithm that runs in quadratic time, O(n^2), for one that runs in linear time, O(n), can really improve the performance of your process. This may be at the cost of requiring more space. Another way to reduce calculation time is to store the results of a calculation to prevent your process from having to do it again and again. This also comes at the cost of requiring more memory, but this might be a good option depending on your process. We'll learn more about this when we get to caching later in the unit.
Fixing a memory bound process
Improving the performance of a memory bound system can be solved in similar ways to CPU bound processes. You need to either put less demand on memory or get more memory. As we mentioned above, on your personal computer you may close any other applications you have running. The more processes you have active at any one time, the more requests each of them makes for space, the more likely you are to run into a memory issue. If we're talking about code that you have written and deployed, one option would be to reduce the need for additional space when performing operations run within your process. Is there a more space efficient algorithm? If not, as we mentioned above, you can trade runtime efficiency for space efficiency. Here you would be decreasing the runtime efficiency, but also reducing the demands on memory.
Reducing I/O bound process issues
As SDEs at Amazon, our I/O bound applications will typically be bound by network calls. Network I/O can be improved by upgrading your ethernet card (the network I/O component). However, the fastest network is much slower than memory and processors. Since a process waiting for I/O can't do anything else (it's blocked), we can try to reduce the number of blocking operations. We can do this by taking advantage of our faster memory. If the same data may be required multiple times, we can perform I/O the first time and save the result in memory, retrieving it quickly in the future. This is called "caching", and we'll cover it in more detail in a later lesson. If we cannot reduce our I/O operations, we can consider utilizing our powerful CPU while we are blocked. If some portion of our process does not require the results of the network I/O results, we can also execute that on the processor while waiting for a response. This is called "concurrency", which we will also learn about in a later lesson.
Conclusion
In this lesson, we learned about common circumstances for bound processes and how different components can be the cause of bottlenecks in execution. Understanding how a process can suffer from slowdowns will help you identify and optimize a process for greater efficiency.
Operating System and Resource Management
The operating system (OS) is system software that manages computer hardware, software resources, and provides services for computer programs.
Memory Management
Memory is organized in a hierarchy, with faster but smaller storage at the top and slower but larger storage at the bottom.
- Registers: Fastest memory, inside the CPU
- Caches (L1, L2, L3): Small, fast memory between CPU and RAM
- Main Memory (RAM): Primary working memory
- Secondary Storage: Hard drives, SSDs
- Tertiary Storage: Tape drives, optical media
Understanding this hierarchy is crucial for optimizing software performance.
File System Management
The operating system manages file systems, organizing and controlling access to files. It provides a hierarchical structure for organizing files and directories.
JVM Tuning
Java Virtual Machine (JVM) tuning involves optimizing the JVM to improve the performance of Java applications. This includes adjusting garbage collection settings, heap size, and other parameters.
Monitoring and Profiling
Monitoring and profiling tools help identify performance bottlenecks and optimize software. Tools like VisualVM, JConsole, and YourKit can provide detailed insights into application performance.
Mastery Task 3: Query, Query on the Wall
Mastery Task 3: Query, query on the wall, don't load just one, get them all!
Next we'll work on the operation that allows a client to check in on the state of their publishing request, GetPublishingStatus. When a book is submitted for publishing via our SubmitBookForPublishing operation, we write to DynamoDB that the request had been queued. We store an item in the table with the keys: {partition: publishingstatus.123, sort: QUEUED}. When the actual publishing logic is implemented it will create a new item in DynamoDB when the request starts to be processed: {partition: publishingstatus.123, sort: IN_PROGRESS}. Finally, when publishing has completed, the publishing logic will again write to DynamoDB: {partition: publishingstatus.123, sort: SUCCEEDED}.
A call to GetPublishingStatus should retrieve each of the items from DynamoDB that correspond to the provided publishingStatusId. If no items are found, the provided PublishingStatusNotFoundException should be thrown.
Create the GetPublishingStatusActivity class and implement the GetPublishingStatus operation using the design documentation's implementation notes and sequence diagram. When populating the response, you will need to convert the list of PublishingStatusItems to a list of PublishingStatusRecords. Follow the pattern used in GetBookActivity when converting the list of BookRecommendations.
Since we haven't implemented the publishing logic, we can't easily generate test data to retrieve with our new API. We have populated your PublishingStatus table with a few complete publishing status histories to help out with your testing. The table below contains publishingStatusIds that you can use for the described test case.
test case | publishingStatusId |
---|---|
successful publishing process | publishingstatus.bdd319cb-05eb-494b-983f-6e1b983c4c46 |
failed publishing process | publishingstatus.4bd41646-b1b2-4627-8304-5180c9b54e00 |
successful new version published | publishingstatus.2bc206a1-5b41-4782-a260-976c0a291825 |
Run MasteryTaskThreeTests workflow to validate your changes.
Exit Checklist:
- You've implemented GetPublishingStatus's functionality
- MasteryTaskThreeTests passes