Course Code: BBC101
Course: AKTU BCA 1st Year, Semester I
Unit: Memory, Storage and Computer Languages
Unit II Overview
Understand how working memory and persistent storage cooperate. Explore the memory hierarchy, cache and virtual memory, compare storage technologies, and follow the roles of assembler, compiler and interpreter.
Topics Covered
| Syllabus area | Pages |
|---|---|
| Memory basics, hierarchy and primary memory | 2-6 |
| Cache memory and access examples | 6-7 |
| Virtual memory and paging | 7-9 |
| Secondary storage devices | 9-13 |
| Languages and translation roles | 13-14 |
| Assembler, compiler and interpreter | 14-16 |
| Solved examples and applications | 16-19 |
| Exam questions with answers | 19-23 |
| Quick revision and glossary | 24-25 |
Learning Outcomes
1. Explain memory units, hierarchy and RAM/ROM.
2. Apply cache and virtual-memory concepts.
3. Compare magnetic, optical and flash storage.
4. Distinguish computer-language representations.
5. Explain assembler, compiler and interpreter roles.
Included in These Notes
30 explained sections; 19 labelled diagrams and sketches; 10 realistic images; 16 solved calculations and cases; 24 short answers; 8 structured long answers; comparison tables and quick revision.
Study Approach
Understand. Connect active processing with memory and storage.
Compare. Use consistent units, properties and translator roles.
Apply. State the model and assumptions before calculating.
Core idea: cache, main RAM, virtual memory and storage describe different roles. Translation prepares or executes program representations; correct results still need a correct algorithm.
1. Memory and storage: the working idea
A computer needs instructions and data that can be obtained when work is performed. Memory provides locations for representing and retaining information during computing. In introductory usage, main memory usually means the working memory directly involved in executing programs, while storage often refers to persistent file-holding devices.
A simple example. A saved document is retained on an SSD or another storage service. When the document is opened, the system brings relevant data into working memory for use by the application. Changes may exist in working state before they are saved. Closing or losing the working session does not necessarily preserve unsaved changes.
Several levels cooperate. Processor registers hold immediately needed values. Cache supports rapid access to selected information. Main memory holds active instructions and data, while secondary storage retains programs and files. These levels differ in speed, capacity, cost and persistence.
Core distinction. A large storage drive does not automatically mean a large amount of RAM. Likewise, installing more RAM does not increase the persistent capacity of an SSD. Describe the role being discussed before comparing numerical capacities.
2. Bits, bytes and capacity units
A bit represents one binary digit, conventionally written as 0 or 1. A byte contains eight bits in the conventions used here. Capacity counts how much data can be represented or retained. Lowercase b commonly denotes bits, while uppercase B denotes bytes; overlooking the distinction can create an eightfold error.
Decimal units. One kilobyte, kB, is 1,000 bytes; one megabyte, MB, is 1,000,000 bytes; one gigabyte, GB, is 1,000,000,000 bytes. Storage-product capacities commonly use decimal units. The symbol alone should be checked against the stated convention when interpreting older material.
Binary units. One kibibyte, KiB, is 1,024 bytes. One mebibyte, MiB, is 1,024 KiB, and one gibibyte, GiB, is 1,024 MiB. These explicit names avoid treating every occurrence of KB or GB as an unambiguous power of 1,024.
Exam method. State the convention supplied in the question. If an introductory question explicitly defines 1 KB as 1,024 bytes, use its assumption and explain the interpretation. Do not mix decimal drive capacity with binary file units without converting both to a common basis.
| Unit | Exact byte count |
|---|---|
| 1 kB | 1,000 B |
| 1 KiB | 1,024 B |
| 1 MB | 1,000,000 B |
| 1 MiB | 1,048,576 B |
| 1 GB | 1,000,000,000 B |
| 1 GiB | 1,073,741,824 B |
3. Properties and access methods
Capacity describes amount, while latency describes delay before a requested operation or result. Transfer rate describes data moved per unit time under specified conditions. A device can have high sequential throughput while still taking relatively long to locate a small scattered item.
Volatility. Volatile memory normally loses its state when power is removed. Nonvolatile storage is intended to retain data without continuous power, subject to device condition and retention limits. Nonvolatile does not mean indestructible, permanent under every condition or a substitute for backup.
Access. Random access allows a specified location to be accessed without traversing all preceding locations; semiconductor RAM is the standard example. Direct access allows locating a region or block, as with disk storage, although positioning delays can vary. Sequential access proceeds through an ordered sequence, as in typical tape use.
Other factors. Compare cost per unit of capacity, endurance, reliability, portability and compatibility. No one measure determines the best choice. A backup archive and a processor cache need different properties even though both hold information.
4. The memory hierarchy
The memory hierarchy combines several levels so that frequently needed work can benefit from faster access while larger amounts of data remain affordable to retain. A typical introductory order is registers, processor cache, main memory and secondary storage. Archival arrangements can extend the hierarchy further.
General trade-off. Levels nearer the processor usually offer lower access latency and smaller capacity at higher cost per bit. Lower levels commonly offer larger capacity and lower cost per bit, with slower access. These are broad design tendencies rather than exact ratios that every device must follow.
Why it works. Programs often reuse recently used information and access nearby locations. Keeping suitable copies at a faster level can therefore reduce average access delay. Transfers and management are performed according to the processor and operating-system design.
Avoid a common error. The hierarchy is not simply a ranking of physical box size. A processor chip can contain multiple cache levels. An SSD is fast relative to many disk workloads but does not thereby become CPU cache or ordinary main RAM.
5. CPU interaction with memory
The CPU obtains instructions and accesses operands as a program runs. Registers hold immediate working values, while cache and main memory provide larger supplies of instructions and data. Relevant results are written back through the system according to its architecture and policies.
Conceptual read. A processor request identifies required information. If a suitable cache has a valid copy, it can supply the data. Otherwise, the request proceeds to another level. For an ordinary main-memory access, active data must be available in the required physical memory arrangement.
Conceptual write. A changed value must be recorded consistently through the relevant levels. Designs use different policies for updating or eventually writing modified cache contents. An introductory diagram shows the roles; it should not imply that every store instruction immediately writes the SSD.
Program execution. A saved application is not normally executed by treating every storage byte as though it were a processor register. The operating system and execution environment make needed code and data available. Detailed transfer mechanisms differ between platforms, but the hierarchy provides the essential model.
6. Primary memory: RAM and ROM roles
Primary memory is commonly introduced as memory associated closely with the processor’s work. Introductory classifications include RAM and ROM, though practical architectures arrange their access differently. Main working RAM and firmware storage serve different purposes.
RAM. Random access memory used as ordinary working memory is readable and writable. Typical main RAM is volatile. It holds active data and code as needed, enabling programs to work with more information than processor registers alone can contain.
ROM. Read-only memory denotes a family of arrangements intended to preserve instructions or data without continuous power, with differing programming and erasure capabilities. Firmware is a common application. Some members can be rewritten under appropriate conditions, so ROM-family does not mean that every device is forever unchangeable.
Use in an answer. Compare working role, writability and volatility rather than saying that RAM contains everything and ROM contains only one fixed kind of program. A particular system’s firmware arrangement and memory mapping determine the exact implementation.
| Basis | Typical working RAM | ROM-family storage |
|---|---|---|
| Role | Active working instructions/data | Retained instructions/data such as firmware |
| Power loss | Usually loses working state | Intended to retain state |
| Writing | Normal program operation | Depends on the ROM-family technology |
7. SRAM and DRAM
Static RAM, or SRAM, stores state through suitable electronic circuits while power is maintained. It does not require the periodic refresh used by DRAM. Static does not mean nonvolatile; ordinary SRAM still needs power to retain its state.
Dynamic RAM, or DRAM, stores information using charge-based cells that require refresh. Its relatively dense and economical implementation makes it common for main memory. Synchronous DRAM and DDR-related designs are developments within the broader DRAM family.
Typical roles. SRAM is commonly associated with processor caches because of its access characteristics, while DRAM commonly supplies larger main-memory capacity. The full performance depends on the device and design; avoid presenting one fixed speed or transistor count as compulsory for every implementation.
Comparison. Both ordinarily provide volatile read/write memory. SRAM generally uses more area per bit and is more expensive per bit, while DRAM gains density but needs refresh. Refresh is a hardware-level requirement and should not be confused with reloading a browser page.
| Basis | SRAM | DRAM |
|---|---|---|
| State maintenance | Powered electronic state | Charge requiring refresh |
| Ordinary volatility | Volatile | Volatile |
| Typical emphasis | Fast cache use | Dense main-memory use |
| Refresh | No DRAM-style periodic refresh | Required |
8. The ROM family and firmware
Mask ROM has its data fixed during manufacture. PROM allows an appropriate one-time programming process. These are useful distinctions within the traditional ROM family; neither should be described as ordinary working RAM.
EPROM can be erased using the appropriate ultraviolet erasure arrangement and reprogrammed. EEPROM supports electrical erasure and rewriting under its device rules. The exact erase granularity and endurance depend on the technology.
Flash memory is a related nonvolatile, electrically programmable technology whose erase operations are organised in blocks. Flash is widely used for storage and firmware-related purposes. A flash chip and a complete SSD are not the same level of device description.
Firmware. Firmware consists of supporting instructions associated with a device or system. Updateable firmware can reside in suitable electrically reprogrammable memory. Its persistence does not make an update risk-free or turn the instructions into physical hardware.
9. Cache memory: purpose and levels
Cache memory retains selected copies of instructions or data so that they can be obtained faster than going to a lower memory level for every access. Processor cache commonly uses SRAM-based technology. It reduces average access delay when the access pattern benefits from reuse.
Levels. L1, L2 and L3 denote successive cache levels in many systems, though the number, ownership and organisation vary. L1 is typically small and close to a core’s execution needs. Other levels can provide more capacity with different access delays and sharing arrangements.
Copies and blocks. Data is commonly transferred and managed in blocks or cache lines. A cache entry includes information needed to determine whether the requested location is represented and whether the copy is usable. Cache is not simply a collection of the most important files chosen by the user.
Limits. A larger cache may help suitable workloads but does not guarantee a proportionate speed increase. Performance also depends on access pattern, miss handling and the rest of the system. Cache capacity is distinct from the main RAM and persistent drive capacity.
10. Cache hits, misses and locality
A cache hit occurs when the requested information is found as a usable copy in the cache being checked. A miss occurs when that cache cannot satisfy the request. The request must then be handled through another level or the appropriate miss procedure.
Temporal locality. Recently used information is likely to be used again in many programs. Repeated use of a small loop or variable can benefit from this pattern. Spatial locality. Information near a requested location may soon be needed, as when neighbouring array elements are processed in order.
Example. Suppose one teaching cache block holds four consecutive data items. Reading the first item may bring the whole block from the next level. Subsequent reads of the other three can hit if the block remains present and valid. The result depends on the initial state and other accesses.
Replacement. A finite cache cannot retain every useful block. When space is needed, a replacement policy selects what to remove. Detailed mapping and coherence algorithms are beyond this introductory requirement; understand that reuse opportunities compete for limited space.
11. Hit ratio and average access time
The hit ratio is the number of hits divided by the number of relevant accesses. The miss ratio is one minus the hit ratio when every access in the model is classified as a hit or miss. State which cache or level is being measured.
Serial teaching model. Assume every request first spends a cache-lookup time, and a miss adds a specified extra penalty. Average time equals lookup time plus miss ratio multiplied by the additional miss penalty. This convention counts the lookup once for every request.
Example. With a 2 ns lookup, 90% hits and an additional 50 ns miss penalty, the average is 2 + 0.10 x 50 = 7 ns. This is not the formula for a differently defined model in which the stated miss time already includes all lookup cost.
Interpretation. An average summarises many requests. A particular miss can take much longer than a hit. The values here are teaching assumptions, not specifications of a product. Explain what is included in each time before substituting numbers.
12. Virtual memory: addresses, not extra RAM chips
Virtual memory provides an address-space abstraction through which a process uses addresses that are mapped to physical memory resources. It supports controlled mapping, isolation and flexible use of physical memory. It is broader than the simplified phrase using disk as RAM.
Address translation. A process refers to virtual addresses. Hardware and operating-system mechanisms translate them according to the current mapping. Two processes can use similar virtual address values without those values necessarily identifying the same physical locations.
Secondary backing. Some virtual-memory arrangements can keep inactive or not-yet-needed content in storage and bring it into RAM when necessary. Not every virtual page must have an allocated swap slot, and not every access involves a disk. File-backed, anonymous and other mappings are managed according to the system.
Limits. Secondary storage is not a physical upgrade to RAM speed or capacity. Excessive movement of needed pages can severely reduce responsiveness. Increasing a paging-file setting does not create more DRAM chips or guarantee that every workload will run well.
13. Paging and demand paging
Paging divides a virtual address space into fixed-size pages for a given arrangement. Physical memory is organised into corresponding frames. A page can be mapped to a frame without all the process’s pages occupying one continuous physical region.
Page and offset. A virtual address can be understood as a page number and an offset within that page. The mapping identifies the corresponding physical frame while retaining the appropriate offset. The page size and example mapping must be stated before doing a calculation.
Demand paging. Needed content can be brought into RAM when required. A reference to a page not currently resident may generate a page fault, which the system handles according to its rules. A valid nonresident page may need to be obtained from backing storage; an invalid access can instead lead to an error.
Performance. Page-fault handling is not an ordinary cache hit. If a workload repeatedly needs pages that cannot remain in RAM, frequent paging can dominate useful work, a condition associated with thrashing. Workload and available physical memory matter more than the promise of unlimited virtual capacity.
14. Cache, RAM and virtual memory compared
Cache, main RAM and virtual memory refer to different ideas. Cache is a faster level retaining selected copies. RAM is physical working memory. Virtual memory is an addressing and management arrangement that maps a process’s view onto physical resources.
Connected example. An application uses a virtual address; translation identifies a physical location according to the system. Relevant cache mechanisms may satisfy the access rapidly. If necessary content is nonresident, the system handles that situation before normal access can proceed.
Different shortages. Cache misses and page faults are not interchangeable terms. A cache miss means a particular cache cannot provide the request. A page fault concerns the virtual-memory mapping or access conditions and can have several causes. Not every cache miss causes storage access.
Exam method. Compare purpose, physical or logical role, management and the meaning of a miss or fault. Do not describe virtual memory as a third physical memory chip positioned between cache and RAM in the speed hierarchy.
| Concept | Principal role |
|---|---|
| Processor cache | Fast selected copies of instructions/data |
| Main RAM | Physical working memory |
| Virtual memory | Address abstraction and mapping |
| Secondary storage | Persistent programs and files; possible backing |
15. Secondary storage: purpose and organisation
Secondary storage retains programs and data for later use, normally without continuous power. Examples include magnetic disks, tape, optical media and flash-based devices. Capacity, access needs, retention, portability and recovery requirements influence the choice.
Device, medium and interface. The medium holds recorded information. A device reads or writes it. An interface provides a communication arrangement between components. For example, NAND flash is a storage technology, an SSD is a device, and an interface such as SATA or PCIe describes another aspect of the system.
Files and blocks. Users often work with named files and directories, while storage hardware and software manage lower-level units and metadata. Available file capacity can be less than the headline raw capacity because of units, formatting, metadata and reserved areas.
Persistence and protection. Saving a file makes it eligible for persistent retention through the actual storage process; it does not make loss impossible. Device failure, mistaken deletion and unsuitable handling can still damage information. Select storage together with an appropriate backup and verification process.
16. Magnetic disk: physical principle
A magnetic disk stores information through magnetic recording on suitable surfaces. In a hard disk drive, one or more platters rotate while read/write heads access locations through an actuator arrangement. The drive controller coordinates operations and presents a usable device interface.
Tracks and sectors. A track is a circular recording path in the introductory model, and a sector is a subdivision used in explaining recorded units. Modern drives expose logical block addresses and can organise the physical medium more elaborately than a simple textbook drawing.
Locating data. Head positioning and platter rotation affect access to a desired region. Once positioned appropriately, data is transferred. Reading a large nearby sequence can have different performance from reading many scattered small regions.
Use. HDDs provide persistent file storage and can be suitable where capacity and workload requirements favour them. A moving mechanism distinguishes them from flash-based SSDs. The drawing here shows concepts rather than a repair guide or exact physical geometry.
17. Disk access time and practical performance
Seek time is associated with moving the head to the relevant track region. Rotational latency is the wait for the desired region to rotate into position. Transfer time is the time to move the requested data. A simplified disk-access model adds these components and any explicitly included overhead.
Example. If a teaching question assumes 5 ms seek, 3 ms average rotational wait and 1 ms transfer, the stated access estimate is 9 ms when other overhead is ignored. This is a model result, not a universal drive speed.
Access pattern. Sequential work can reduce repeated positioning compared with scattered requests. Queueing, caching, request size and controller behaviour also affect observed performance. Interface maximum transfer rate should not be treated as the achieved speed of every read.
Capacity terminology. Formatting and file-system management help make a storage device usable for files. Deleting a file entry, securely erasing data and physically destroying a medium are different operations. This unit needs the conceptual distinction rather than detailed device-specific procedures.
18. Magnetic tape and sequential access
Magnetic tape records information on a moving strip of suitable magnetic medium. It is commonly supplied in cartridges for compatible drives and may be managed through automated libraries. Tape remains useful for appropriate backup and archival workloads; it is not merely an obsolete classroom example.
Sequential emphasis. Reaching a particular part can require positioning through the tape path. Once an appropriate sequence is reached, streaming substantial data can be efficient. It is generally a poor fit for frequently changing small interactive requests compared with suitable online storage.
Uses and limitations. Large backup sets and long-term retained copies can suit tape when the organisation has appropriate drives, procedures and management. Access delay, media compatibility, verification and the ability to restore are part of the decision. A cartridge alone does not provide a readable archive without supporting equipment.
Comparison. Tape and disk both use magnetic recording, but their physical organisation and typical access behaviour differ. Do not infer that any magnetic medium must have identical speed, access method or service role.
19. Optical disks: CD, DVD and Blu-ray
Optical media are read using appropriate light-based sensing arrangements. The disc, recording format and drive must be compatible. Optical should not be confused with magnetic merely because both can use rotating circular media.
Families. CD, DVD and Blu-ray provide different recording formats and capacities. Common teaching examples include a roughly 700 MB CD, a 4.7 GB single-layer DVD and a 25 GB single-layer Blu-ray disc. These describe particular common formats, not every disc in each family.
Recording variants. Read-only pressed media, recordable media and rewritable media use different recording arrangements. Their names indicate whether and how they can be recorded. It is inaccurate to say that every optical disc uses the same permanent pits or that every disc can be erased and reused.
Selection. Consider available drives, required format, capacity, compatibility and physical condition. Scratches, unsuitable handling and media deterioration can affect readability. A nominal capacity alone does not establish successful long-term retention or the ability to read a disc on every computer.
20. Flash memory and portable storage
Flash memory is nonvolatile semiconductor storage whose cells retain information without ordinary continuous power. It uses electrical programming and organised erase operations. NAND and NOR are important flash families with different design emphases; detailed cell physics is not required for this unit.
Programming and erasure. Flash is not operated exactly like main DRAM. Reading, programming and erasing follow device rules, and repeated programming/erasure contributes to wear. Controllers and management methods can improve practical use, but endurance and retention remain finite.
Products. USB flash drives and memory cards combine flash with control and interface arrangements. USB describes an interface family, while a memory-card format describes another product form. A device’s appearance or connector does not alone establish capacity, speed or compatibility.
Advantages and cautions. Flash-based portable products are compact and have no rotating disk mechanism. They can still fail, be misplaced or contain corrupted data. Important information should not rely on one removable device simply because its storage is nonvolatile.
21. Solid-state drives and HDD comparison
A solid-state drive is a storage device using solid-state technology, commonly NAND flash, together with a controller and management functions. It presents persistent block storage without the rotating platter and mechanical actuator of an HDD.
Performance. The absence of mechanical positioning can improve many access patterns, especially suitable scattered reads. Actual speed still depends on device design, interface, workload, available resources and operating conditions. SSD is not a guarantee of one fixed transfer rate.
Terminology. M.2 commonly describes a module form factor and related connector arrangement; NVMe is a storage protocol commonly used over PCIe. SATA describes a different interface arrangement. Not every M.2 product uses the same protocol, and not every SSD is an M.2 module.
Decision. Compare workload, capacity, compatible interface, cost, endurance and protection requirements. Both SSD and HDD storage are normally nonvolatile, and neither replaces working RAM. A better storage device can improve loading without eliminating every program bottleneck.
| Basis | HDD | Typical flash SSD |
|---|---|---|
| Medium | Magnetic rotating platter | Semiconductor flash |
| Positioning | Mechanical head and rotation | No platter seek or rotation |
| Typical emphasis | Capacity/workload fit | Responsive access/workload fit |
| Persistence | Nonvolatile | Nonvolatile |
22. Choosing among storage technologies
A suitable choice begins with the work. Processor-active data needs working memory, an interactive application needs suitable online file storage, and an archive needs retained readable copies with a workable recovery process. Comparing capacity without the intended use is incomplete.
Example choices. A laptop may use an SSD for its operating environment and files. A large sequential backup may use a managed tape arrangement. An offline distribution task may use supported optical media, while a temporary transfer may use a suitable removable flash device.
Compare fairly. Use the same capacity convention and include the required reader, controller, interface and support. Assess access delay separately from sustained throughput. If a task needs frequent small updates, a high streaming rate alone may be irrelevant.
Trade-off. Portability can aid transfer but increase loss risk. More retained copies can support recovery but require consistency and access control. Explain the requirement and justify the choice; no medium is universally best for every speed, cost and retention objective.
| Technology | Typical useful role |
|---|---|
| Main RAM | Active working data, not a persistent archive |
| HDD/SSD | Online persistent file and application storage |
| Tape | Managed large sequential backup/archive |
| Optical media | Supported distribution or offline copies |
| Removable flash | Portable storage and transfer |
23. Saving, backup and recovery of stored information
Saving and backing up are related but different. Saving updates the intended working file through the application and storage arrangement. Backup creates retained recovery copies under a defined process. A copy on the same failing device may not provide the independence required for recovery.
Recovery thinking. Decide what information matters, how recent a usable copy must be and whether the copy can actually be restored. Retained versions can help when a later change is wrong. A successful copy operation does not prove that every required file and dependency is recoverable.
Practical distinctions. Synchronisation keeps selected locations aligned; it can also propagate an unwanted deletion depending on the service. Redundancy supports selected failure scenarios but is not identical to backup. These terms describe purposes and behaviour, not interchangeable labels for all extra storage.
Unit connection. Volatility explains why active working state and persistent copies must be distinguished. Device compatibility and verification explain why an old tape or disc is not automatically a usable archive. Responsible retention depends on procedures as well as the medium.
24. Computer languages: machine, assembly and high level
A programming language provides a way to express instructions and structures for computation. The processor ultimately performs operations defined by its machine-level architecture, while people often write more convenient symbolic or high-level forms.
Machine language. Machine instructions are encoded for the target architecture. They are not simply any file containing zeros and ones. Assembly language uses architecture-related symbolic instructions, labels and other constructs. Its syntax and operations depend on the assembler and target.
High-level languages provide abstractions such as expressions, procedures and structured control. They can make programs easier to develop and maintain. Portability improves when suitable implementations exist, but operating-system interfaces, data assumptions and external dependencies can still matter.
Important qualification. Compiled and interpreted are implementation approaches, not permanent natural properties of a language. A language can have several implementations, and one implementation can combine translation stages. Avoid assuming that every high-level statement maps to exactly one machine instruction.
25. Source code, target code and translator roles
Source code is the representation supplied to a translation or processing stage. Target code is the output representation from that stage. Object code commonly denotes an intermediate build product, often containing machine instructions and relocation information, rather than a completely ready executable.
Three roles. An assembler processes assembly-language source. A compiler translates a source representation into another target representation. An interpreter executes or evaluates a program representation through its runtime. These roles can cooperate within one implementation.
Supporting stages. Preprocessing can prepare source text, linking can combine object modules and required libraries, and loading makes an executable arrangement ready for execution. Exact stages vary. A compiler error is not the same as failure to find a library during linking.
Simple model. A C-style toolchain may preprocess, compile, assemble and link before producing an executable. This is an explanatory workflow, not proof that every language or compiler must generate a separate visible assembly file.
26. Assembler: symbolic instructions to object code
An assembler translates assembly-language constructs into the relevant object representation and associated information. It resolves supported symbols, interprets directives and emits instructions or data according to its rules. The target architecture determines the available machine instructions.
Mnemonics and labels. A mnemonic is a symbolic name used for an operation in a particular assembly syntax. A label can identify a location or symbol. A directive tells the assembler how to organise or process input; it need not represent an instruction executed by the CPU.
Do not overstate one-to-one mapping. Many ordinary assembly instructions have a close relationship to machine instructions, but macros, pseudo-instructions and directives mean that not every source line produces exactly one machine instruction. Blank lines and comments may produce none.
Example notation. A conceptual sequence such as load value, add value and store result illustrates processor-level steps. It is explanatory pseudocode unless a real architecture and syntax are specified. An assembler for one target cannot be assumed to translate an unrelated target’s source correctly.
27. Compiler: translation and the build result
A compiler translates a program from a source language or representation into a target representation. The target may be machine code, assembly, bytecode or another intermediate form. Therefore, the definition should not require that every compiler immediately produces a standalone executable.
Broad activities. Analysis recognises the program structure and checks relevant rules. Intermediate representations help organise the computation. Transformations may improve implementation efficiency, and code generation emits the target. A first-year answer need not reproduce every internal compiler phase.
Build and run. Compilation can detect syntax and certain semantic errors, but successful translation does not prove logical correctness. Linking may still be required, and an executed program can encounter input-dependent problems. A wrong formula can compile successfully.
Benefits and limits. Ahead-of-time translation can prepare a program for repeated execution without repeating all source-analysis work each time. The practical performance depends on implementation and workload. Compilation time, execution time and total development effort are different measures.
28. Interpreter: executing a program representation
An interpreter implements program behaviour by reading or otherwise processing a representation during execution. It may work from source-like structures, syntax trees or intermediate instructions. The classroom phrase line by line is a simplified description, not a universal internal design.
Interaction. An interactive environment can let a learner evaluate expressions and observe results promptly. Repeated execution may involve runtime interpretation, caching or other preparation depending on the implementation. It is incorrect to conclude that interpreted implementations never compile anything.
Errors. Some problems are detected before a program begins useful execution, while others appear only when a particular path is reached. An interpreter is not guaranteed to execute all earlier textual lines before reporting any syntax problem. Distinguish the implementation’s checks from general slogans.
Suitability. Interactive exploration, scripting and flexible environments can benefit from interpretation or mixed approaches. Performance and deployment requirements still matter. An interpreter and the program it runs are separate software components even when presented through one application.
29. Compiler, interpreter and mixed implementations
The central distinction is the role of translation versus execution, not a guarantee that one approach is always faster or that one can find every error. A compiler produces a target representation, while an interpreter carries out behaviour from a representation.
Mixed example. A source program may be compiled to bytecode for a virtual machine. The runtime may interpret that code, compile selected work just in time, or combine both. Bytecode is an instruction representation for its execution environment, not automatically native machine instructions for every processor.
Portability. Intermediate code can be useful across platforms with compatible runtimes, but libraries, runtime versions and platform dependencies still matter. A native executable normally targets an architecture and environment; copying it elsewhere does not guarantee execution.
Exam approach. Present the conventional distinction, then add the qualification about real implementations. This gives a clear introductory answer without teaching the misleading rules that a compiler always makes an executable or an interpreter always reads one source line at a time.
| Role | Essential action |
|---|---|
| Assembler | Translate supported assembly constructs |
| Compiler | Produce a target representation |
| Interpreter | Execute/evaluate a representation |
| Mixed runtime | Combine stages such as bytecode and JIT |
30. Translation errors, runtime errors and logical errors
Translation-time errors include problems detected by a compiler or assembler, such as invalid syntax or unsupported constructs under the relevant rules. The exact checks depend on the language and implementation. Not every semantic mistake is detected statically.
Linking errors can arise when required definitions or compatible modules are unavailable. Runtime errors occur during execution, such as an invalid operation under the runtime’s rules or inability to obtain a required resource. Their precise handling depends on the environment.
Logical errors produce unsuitable behaviour even when translation and execution complete. For example, adding two values when the task requires multiplication may not violate any language rule. Testing uses expected outcomes and varied cases to reveal such problems.
Integrated example. A stored source file is processed by a toolchain, the resulting program runs with needed working memory, cache helps suitable accesses and storage retains files. Correct operation requires suitable translation, sufficient resources, appropriate data and a correct intended algorithm.
SOLVED EXAMPLES AND APPLICATIONS
The following are original teaching examples. Identify the relevant role, working principle and assumptions before interpreting the result.
Solved example 2.1: Bits and bytes
A teaching data block contains 256 bytes. How many bits does it contain, using eight bits per byte?
1. Choose the relationship. Number of bits = number of bytes x 8.
2. Calculate. 256 x 8 = 2,048 bits. Byte count and bit count describe the same block using different units.
Answer. The block contains 2,048 bits. Keep b and B distinct when interpreting capacity or transfer measures.
Solved example 2.2: Binary capacity conversion
Express 8 MiB in KiB and bytes.
1. Convert to KiB. 8 x 1,024 = 8,192 KiB.
2. Convert to bytes. 8 x 1,048,576 = 8,388,608 bytes.
Answer. 8 MiB = 8,192 KiB = 8,388,608 B. The explicit binary prefixes determine the multipliers.
Solved example 2.3: Decimal and binary labels
A stated capacity is exactly 1 GB in the decimal convention. Is it the same as 1 GiB?
1. Write exact quantities. 1 GB = 1,000,000,000 bytes. 1 GiB = 1,073,741,824 bytes.
2. Compare. The binary quantity exceeds the decimal quantity by 73,741,824 bytes. Expressing decimal bytes in GiB gives approximately 0.9313 GiB.
Answer. They differ. A changed unit display does not by itself prove that physical storage has disappeared.
Solved example 2.4: Idealised file count
A teaching store has 64 MiB available and each file occupies exactly 2 MiB. Ignore file-system overhead and assume no other use. How many complete files fit?
1. Use a common unit. Both values use MiB, so the capacity ratio is directly comparable.
2. Calculate. 64 / 2 = 32 complete files. No rounding issue arises in this example.
Answer. 32 files fit under the stated idealisation. Real available capacity and allocation can reduce an actual count.
Solved example 2.5: Power loss and memory role
A user edits a document in ordinary RAM without saving, while an older copy exists on an SSD. Explain what power loss means for the two copies.
1. Working state. Ordinary volatile RAM does not preserve the editing state after power loss. The unsaved changes are not guaranteed to remain.
2. Persistent file. The older saved copy is intended to remain on nonvolatile storage, subject to successful prior saving and device condition.
Answer. Working RAM and persistent storage serve different roles. Do not assume that the unsaved state was preserved merely because the computer has an SSD.
Solved example 2.6: Cache hit ratio
A stated cache records 180 hits and 20 misses during 200 requests. Find hit and miss ratios.
1. Count the same request set. 180 + 20 = 200, so every request is classified once in the model.
2. Calculate. Hit ratio = 180 / 200 = 0.90 = 90%. Miss ratio = 20 / 200 = 0.10 = 10%.
Answer. The hit ratio is 90% and the miss ratio 10% for this cache and request set.
Solved example 2.7: Average cache access time
Every request spends 2 ns on lookup. A miss adds an extra 50 ns. If hit ratio is 90%, find the average under this serial model.
1. Identify the penalty convention. The 50 ns is additional to the lookup, not an already complete miss time. Miss ratio = 1 – 0.90 = 0.10.
2. Apply the model. Average = 2 + 0.10 x 50 = 7 ns. Equivalently, 0.90 x 2 + 0.10 x 52 = 7 ns.
Answer. The average is 7 ns. Different timing definitions require a correspondingly different formula.
Solved example 2.8: Spatial locality in a small example
A teaching cache is initially empty. One block holds items A0 to A3. The program reads A0, A1, A2 and A3 in order, with no eviction or other access. Classify the four reads.
1. First access. A0 misses because the cache is empty. The assumed block fetch brings A0 to A3 into the cache.
2. Remaining accesses. A1, A2 and A3 hit under the stated assumptions. Three of the four requests are hits, giving 75% hit ratio for this short sequence.
Answer. One miss and three hits illustrate spatial locality. The result depends on the block size, initial state and absence of eviction.
Solved example 2.9: Page and frame count
A teaching virtual region has 16 KiB of data and page size is 4 KiB. How many pages are required if the region begins on a page boundary?
1. Use equal units. Page count = region size / page size = 16 / 4.
2. Calculate and qualify. The region uses four pages. This does not prove that all four are simultaneously resident in physical RAM.
Answer. Four virtual pages are required. The stated alignment avoids an additional partial boundary page.
Solved example 2.10: Simple page mapping
Page size is 4,096 bytes. Virtual page 2 is mapped to physical frame 0, and the offset is 100. Find the zero-based virtual and physical byte addresses.
1. Virtual address. Virtual address = 2 x 4,096 + 100 = 8,292.
2. Physical address. Physical address = 0 x 4,096 + 100 = 100. Translation changes the page/frame part while preserving this offset.
Answer. The virtual byte address is 8,292 and the physical byte address is 100 under the given mapping.
Solved example 2.11: Simplified disk access
A disk-access question assumes 5 ms seek, 3 ms rotational wait and 1 ms transfer. Ignore all other overhead. Find the estimate.
1. State the model. The simplified time is seek + rotational wait + transfer.
2. Calculate. 5 + 3 + 1 = 9 ms. The units are consistent and the assumptions exclude queueing and other controller work.
Answer. The stated estimate is 9 ms. It is not a universal time for every request on a real drive.
Solved example 2.12: Ideal transfer duration
A file contains 600 MB and a teaching transfer sustains exactly 100 MB/s. Ignore setup, protocol and other overhead. Find the duration.
1. Use compatible decimal measures. Both quantities use MB, so time = file size / sustained rate.
2. Calculate. 600 / 100 = 6 seconds. This concerns sustained transfer, not necessarily time to locate the file.
Answer. The idealised transfer duration is six seconds. Setup and access delay can increase elapsed time in practice.
Solved example 2.13: Choose a storage arrangement
A firm needs fast interactive file access and a separate large sequential backup archive. Explain why one medium need not serve both jobs.
1. Interactive role. A suitable online SSD or HDD arrangement can support the active file workload, depending on capacity, cost and performance requirements.
2. Archive role. A managed tape system may suit large sequential backups when compatible equipment, verification and restoration procedures are available.
Answer. Select each arrangement for its workload and recovery needs. A tape cartridge alone is not a complete backup system.
Solved example 2.14: Compiler, assembler or interpreter?
Identify the role that processes assembly constructs, the role that emits a target representation, and the role that carries out behaviour from a program representation.
1. Translation roles. An assembler processes supported assembly-language constructs. A compiler translates a source representation into a target representation.
2. Execution role. An interpreter or runtime executes/evaluates a program representation. A real toolchain may combine these roles.
Answer. Assembler, compiler and interpreter respectively. The distinction concerns role, not a guarantee of one exclusive implementation per language.
Solved example 2.15: An error that translation cannot guarantee to catch
A program correctly expresses total = price + quantity, but the task requires multiplication. Must a successful compiler reject it?
1. Language rule versus intention. The addition may be valid syntax with compatible operands, so it need not violate the language rules checked by the compiler.
2. Test the required result. Use expected examples to compare actual behaviour with the task. For price 25 and quantity 4, addition gives 29 while multiplication gives 100.
Answer. No. This is a logical error under the stated task, even if compilation and execution succeed.
Solved example 2.16: Working set and virtual memory
An application repeatedly needs more active pages than can remain in the available RAM. Increasing a paging-file limit does not make it responsive. Explain.
1. Identify the active resource need. The frequently needed content still has to be available through the physical-memory arrangement to perform ordinary work efficiently.
2. Explain movement cost. Frequent eviction and refetching can cause excessive paging or thrashing. A larger backing area can permit more retained virtual content without providing DRAM-like access speed.
Answer. Virtual backing is not an equivalent physical RAM upgrade. Review the workload, available RAM and observed paging behaviour.
EXAM QUESTIONS WITH ANSWERS
Practice questions covering the definitions, comparisons and applications in Unit II.
Short-answer practice
Q1. What is the role of main memory?
Answer. Main memory holds active instructions and data needed during computing. It works with processor registers and caches, while persistent storage retains programs and files for later use.
Q2. Distinguish a bit and a byte.
Answer. A bit represents a binary digit. A byte contains eight bits under the convention used here. Lowercase b and uppercase B should be distinguished when interpreting capacity and rate.
Q3. How do KiB and kB differ?
Answer. One KiB is 1,024 bytes, while one kB is 1,000 bytes. Explicit binary and decimal prefixes avoid an ambiguous interpretation of older KB terminology.
Q4. What is volatile memory?
Answer. Volatile memory normally requires power to retain its state. Ordinary working DRAM and SRAM are volatile. Nonvolatile storage is intended to retain information without continuous power but can still fail.
Q5. Define memory hierarchy.
Answer. The memory hierarchy combines levels such as registers, cache, main RAM and secondary storage to balance access delay, capacity and cost. Levels nearer the processor are generally faster and smaller.
Q6. Distinguish SRAM and DRAM.
Answer. SRAM maintains suitable powered circuit state without DRAM-style refresh. DRAM uses charge-based cells needing refresh. Both are normally volatile; SRAM commonly serves caches and DRAM main memory.
Q7. Why is static RAM not necessarily permanent memory?
Answer. Static means that ordinary SRAM does not need DRAM-style periodic refresh. It still normally loses state when power is removed, so static is not another word for nonvolatile.
Q8. Name traditional ROM-family types.
Answer. Mask ROM, PROM, EPROM, EEPROM and related flash arrangements have different programming and erasure rules. Not every member is permanently unchangeable after manufacture.
Q9. Define cache memory.
Answer. Cache retains selected copies of instructions or data for faster access than a lower level. Its usefulness depends on access patterns, capacity, organisation and miss handling.
Q10. What is temporal locality?
Answer. Temporal locality is the tendency for recently used information to be used again. A repeatedly accessed variable or small loop can benefit when the relevant content remains in cache.
Q11. What is spatial locality?
Answer. Spatial locality is the tendency for nearby information to be needed soon. Reading neighbouring array items can benefit when one fetched cache block contains several of them.
Q12. Define cache hit ratio.
Answer. Cache hit ratio is hits divided by the relevant accesses for the cache being assessed. When all requests are classified as hit or miss, miss ratio equals one minus hit ratio.
Q13. What is virtual memory?
Answer. Virtual memory is an address-space abstraction and mapping arrangement. It supports controlled use of physical resources and may use storage backing for suitable nonresident content; it is not simply extra RAM hardware.
Q14. What is a page fault?
Answer. A page fault is an event related to virtual-memory access or mapping conditions. A valid nonresident page may need to be brought into RAM, while an invalid access can instead result in an error.
Q15. What is thrashing?
Answer. Thrashing is excessive paging activity associated with inadequate resident working-set support, so movement and fault handling dominate useful work. More backing-store capacity alone does not guarantee a remedy.
Q16. Distinguish tape and disk access.
Answer. Tape emphasises sequential positioning and streaming. Disk supports direct access to regions, with positioning and rotation delays in HDDs. Both may use magnetic recording but suit different access patterns.
Q17. What is optical storage?
Answer. Optical storage uses compatible light-based reading arrangements for formats such as CD, DVD and Blu-ray. Read-only, recordable and rewritable variants have different recording capabilities.
Q18. Define flash memory.
Answer. Flash is nonvolatile semiconductor memory with electrical programming and organised block erasure. It is used within products such as USB drives, memory cards and many SSDs, with finite endurance and retention.
Q19. How does an SSD differ from RAM?
Answer. An SSD is persistent storage with a device controller and storage interface. Ordinary main RAM provides volatile working memory. An SSD does not become RAM simply because it improves loading or paging performance.
Q20. Does an M.2 connector guarantee NVMe?
Answer. No. Form factor and protocol are different aspects. M.2 commonly describes a module arrangement, while NVMe is a protocol commonly carried over PCIe. Compatibility must be checked for the particular product and system.
Q21. What does an assembler do?
Answer. An assembler processes supported assembly constructs into the relevant object representation and related information. Directives and macros mean that not every source line produces exactly one machine instruction.
Q22. Define a compiler.
Answer. A compiler translates a source representation into a target representation. Targets can include machine code, assembly or bytecode; a compiler need not directly produce a standalone executable.
Q23. Define an interpreter.
Answer. An interpreter executes or evaluates a program representation. Its input may be source-like structures or intermediate instructions, so line-by-line source translation is only a simplified classroom description.
Q24. Does successful compilation prove a correct program?
Answer. No. Translation checks cannot guarantee that the program implements the intended task. Linking, runtime and logical problems can remain. Test with expected results and appropriate varied cases.
Structured long-answer practice
Use a definition, clearly separated points, a relevant example and a labelled diagram or comparison where appropriate. Match the length to the marks and the question rather than memorising a fixed word count.
Long question 1. Explain the memory hierarchy and CPU-memory interaction.
Answer
1. Purpose. A system needs immediate working values, active instructions and persistent files. Combining several levels balances capacity, access delay and cost more effectively than trying to make every stored byte as fast as a register.
2. Levels. Registers hold immediate values inside the processor. Cache provides selected fast copies. Main RAM supplies larger working capacity. Secondary storage retains files and programs, with other arrangements supporting archive needs.
3. Interaction. Processor requests can be satisfied by a usable cache copy or passed to another level. Changed values are maintained according to the system policies. A processor store does not imply an immediate SSD write for every instruction.
4. Locality. Temporal reuse and access to nearby data make selected fast copies useful. The effect depends on the access pattern and cache behaviour, not simply the presence of an additional memory device.
5. Trade-off. Closer levels are generally faster and smaller at higher cost per bit. Exact sizes and timings vary. More persistent capacity does not replace active RAM, and a large RAM value does not itself increase file-storage capacity.
Long question 2. Compare RAM, SRAM, DRAM and the ROM family.
Answer
1. Working RAM. Ordinary main RAM holds active instructions and data and is readable and writable during normal work. It is normally volatile. The term random access describes access to selected locations rather than random contents.
2. SRAM. Static RAM retains suitable circuit state while powered without DRAM-style refresh. It is commonly associated with cache use. Static should not be interpreted as permanent retention without power.
3. DRAM. Dynamic RAM uses charge-based cells requiring refresh. Its density and cost characteristics make it common for larger main-memory capacity. Detailed performance depends on the design.
4. ROM variants. Mask ROM is fixed during manufacture; PROM supports an appropriate one-time programming process. EPROM, EEPROM and flash provide different erasure or rewrite arrangements. Flash erases in blocks and also serves many storage devices.
5. Role distinction. Firmware can reside in suitable nonvolatile memory, including updateable arrangements. RAM/ROM comparisons should use purpose, power retention and programming rules rather than claiming every retained instruction can never change.
Long question 3. Explain cache hits, locality and average access time.
Answer
1. Cache purpose. Cache retains selected usable copies to reduce access delay to needed instructions or data. Multiple cache levels may exist, but their size, sharing and organisation vary by system.
2. Hits and misses. A hit means the cache can supply the request from a valid copy. A miss means it cannot, so another level or miss procedure is needed. The hit ratio refers to a defined set of requests and a particular cache.
3. Locality. Temporal locality supports reuse of recently accessed information. Spatial locality supports nearby accesses. Fetching a block can therefore help later references to neighbouring items while that block remains available.
4. Calculation. Under the serial model, every request pays lookup time and misses add a stated additional penalty. Average time = lookup + miss ratio x extra penalty. With 2 ns, 10% misses and 50 ns extra penalty, the average is 7 ns.
5. Limits. The model depends on its timing definition. A larger cache does not guarantee proportional acceleration, and a cache miss is not automatically a page fault or an SSD read.
Long question 4. Explain virtual memory and paging, distinguishing them from cache.
Answer
1. Address abstraction. Virtual memory supplies a controlled address-space view mapped to physical resources. It supports useful separation and flexible mapping. Describing it only as disk used as RAM misses these central purposes.
2. Pages and frames. Paging divides the virtual address space into pages and corresponding physical capacity into frames. Translation maps the relevant page to a frame while preserving the offset in the simple model. Pages need not occupy one continuous physical region.
3. Nonresident content. Demand paging can bring suitable needed content into RAM. A page fault is handled according to validity and mapping rules; some faults require content retrieval, while invalid accesses can lead to an error.
4. Performance. When too much frequently needed content competes for limited resident space, repeated movement can cause thrashing. A larger paging-file limit is not equivalent to more DRAM or guaranteed responsiveness.
5. Comparison. Cache is a fast selected-copy level. RAM is physical working memory. Virtual memory is an addressing and management arrangement. Not every cache miss causes a page fault, and not every virtual access uses disk.
Long question 5. Compare magnetic, optical and flash-based secondary storage.
Answer
1. Magnetic disk. HDDs record on rotating magnetic platters with head positioning and rotational behaviour. They support direct access to regions, though scattered and sequential workloads have different performance.
2. Magnetic tape. Tape supports sequential positioning and streaming. Managed large backups or archives can suit it when drives, compatibility, verification and restoration are available. It is not generally the best fit for small frequent interactive requests.
3. Optical media. CD, DVD and Blu-ray need compatible media and drives. Read-only, recordable and rewritable formats differ. Their capacities and recording principles should not be treated as identical.
4. Flash products. Flash retains state in semiconductor cells and follows electrical programming and block-erase rules. USB drives, cards and many SSDs combine it with controllers and interfaces. Endurance and retention remain finite.
5. Selection. Compare workload, access delay, sustained throughput, capacity, compatibility, cost and recoverability. Nonvolatile does not mean immune to failure, so preservation requires suitable copies and verification.
Long question 6. Explain assembler, compiler and interpreter with their relationships.
Answer
1. Assembler. An assembler processes target-related symbolic instructions, labels and directives into an object representation. Macros and pseudo-instructions prevent a universal one-source-line-to-one-machine-instruction rule.
2. Compiler. A compiler translates a source representation into a target representation. The output may be assembly, object code or bytecode, and additional build stages can be necessary. Successful translation does not establish the intended logical correctness.
3. Interpreter. An interpreter executes or evaluates a program representation through its runtime. Its internal input may be structured or intermediate code, so it need not literally analyse one source line at a time.
4. Mixed implementation. A source program can be compiled to bytecode and then interpreted or compiled further during execution. These are cooperating roles. Compiled and interpreted should not be treated as immutable properties of every language.
5. Practical result. Choose an implementation using development, deployment, portability and performance requirements. Do not claim that one method always executes faster or finds every error.
Long question 7. Describe a build-and-run workflow and explain different error stages.
Answer
1. Source and translation. A programmer expresses the algorithm in source form. Relevant stages may preprocess, compile and assemble it, producing target representations or object modules. The exact stages depend on the implementation.
2. Link and load. Linking combines required modules and definitions, and loading prepares the executable arrangement for use. A missing required definition is different from invalid source syntax.
3. Execution and resources. During execution, the runtime and system make needed instructions and data accessible through memory arrangements. Cache, RAM and persistent storage serve distinct connected roles.
4. Check results. Translation or runtime checks do not guarantee the intended algorithm. Test expected outputs and varied cases to identify logical errors as well as execution failures.
Long question 8. A computer has ample SSD capacity but becomes slow when several applications run. Explain the memory-related investigation.
Answer
1. Separate capacities. SSD capacity describes persistent file storage, while RAM provides physical working capacity. Free drive space does not establish that all active application pages fit in RAM. Cache is another distinct level and virtual memory is an addressing arrangement.
2. Observe the workload. Determine which applications and data are active, whether responsiveness changes when some tasks stop, and whether the system reports substantial paging or other resource pressure. The presence of several applications alone does not prove that memory is the only bottleneck.
3. Interpret paging. If frequently needed pages repeatedly leave and re-enter RAM, fault handling and transfer can dominate work. A larger paging-file limit may provide more backing capacity without supplying DRAM-like access speed. This explains why changing one storage setting is not a guaranteed performance improvement.
4. Check alternatives. Processor demand, storage activity and other dependencies can also affect response. Compare observations with the actual task, rather than replacing hardware solely because one capacity number looks small. A cache miss is not automatically a disk access.
5. Choose and verify. A justified response may reduce the active workload or provide compatible working-memory capacity where evidence supports it. Evaluate the outcome using the same task and conditions. Preserve reliable stored copies and avoid treating an upgrade as proof that the program algorithm or data is correct.
QUICK REVISION – UNIT II
The complete unit at a glance
| Syllabus area | Essential understanding |
|---|---|
| Memory and hierarchy | Units, capacity, access behaviour; registers, cache, main RAM and persistent storage. |
| Primary memory | Working RAM; SRAM/DRAM distinctions; ROM-family programming and retention. |
| Cache | Selected usable copies, locality, hits, misses and a stated timing model. |
| Virtual memory | Address abstraction, pages/frames, resident content and appropriate fault handling. |
| Secondary devices | Magnetic disk/tape, optical media and flash-based storage; compare workload and recovery. |
| Computer languages | Machine, assembly and high-level forms; source and target representations. |
| Translator roles | Assembler processes assembly; compiler emits a target; interpreter executes a representation. |
Memory concepts compared
| Concept | Main role | Key distinction |
|---|---|---|
| Cache | Fast selected copies | A miss need not cause a page fault |
| Main RAM | Physical working memory | Normally volatile DRAM in typical systems |
| Virtual memory | Controlled address mapping | Not extra physical RAM chips |
| Secondary storage | Retain programs/files | Persistence does not guarantee recovery |
Rules for solved examples
| Measure | Rule and assumption |
|---|---|
| Bits from bytes | Bytes x 8 under the stated convention. |
| Binary capacity | 1 KiB = 1,024 B; 1 MiB = 1,048,576 B. |
| Hit ratio | Hits / relevant accesses. Miss ratio = 1 – hit ratio in the two-outcome model. |
| Average cache time | Lookup time + miss ratio x additional penalty, for the stated serial model. |
| Page count | Round up size / page size; check alignment and the question assumptions. |
| Simple mapped address | Frame number x page size + offset, using the given zero-based mapping. |
| Disk access estimate | Seek + rotational wait + transfer + any explicitly included overhead. |
| Ideal transfer duration | Size / sustained rate using consistent units; account for excluded delays. |
Memory cues
Hierarchy: registers, cache, RAM, storage. Static versus dynamic: refresh distinction, not power-free permanence. Virtual: address view and mapping. Translators: assemble symbols, compile targets, interpret behaviour.
Abbreviations and key terms
| Term | Meaning |
|---|---|
| Bit / byte | One binary digit / eight bits under the stated convention. |
| KiB / MiB | Binary capacity units: 1,024 B / 1,048,576 B. |
| Latency | Delay before the required operation or result. |
| Throughput | Data or work completed per unit time under stated conditions. |
| Volatile | Normally requires power to preserve state. |
| SRAM | Static random access memory. |
| DRAM | Dynamic random access memory. |
| ROM | Read-only memory family. |
| EEPROM | Electrically erasable programmable read-only memory. |
| Cache hit | A cache supplies a usable requested copy. |
| Locality | Useful reuse in time or nearby locations. |
| Virtual memory | Controlled virtual-address view and physical-resource mapping. |
| Page / frame | Virtual page unit / corresponding physical-memory unit. |
| Thrashing | Excessive paging dominating useful work. |
| HDD / SSD | Hard disk drive / solid-state drive. |
| Flash | Nonvolatile semiconductor memory with organised block erasure. |
| Source / target | Input representation / output of a translation stage. |
| Assembler | Translator for supported assembly constructs. |
| Compiler | Translator producing another representation. |
| Interpreter | Runtime executing/evaluating a representation. |
Common mistakes to avoid
Mixing bits, bytes, decimal units and binary units.
Calling ordinary SRAM nonvolatile because it is static.
Describing every ROM-family device as permanently unchangeable.
Treating cache, main RAM and virtual memory as interchangeable.
Adding lookup time twice when a miss time already includes it.
Assuming an SSD interface rating is the achieved rate of every request.
Saying every compiler directly creates a standalone executable.
Assuming successful translation proves the intended algorithm correct.
Final answer check: define the role; distinguish physical storage from address abstractions; state units and assumptions; show calculation steps; explain translator input/output and the result limits.