ScholarQuill logoScholarQuillUniversity Notes
  • Notes
  • Past Papers
  • Blogs
  • Todo
Login
ScholarQuill logoScholarQuillUniversity Notes
Login
NotesPast PapersBlogsTodo
More
SubjectsDiscussionCGPA CalculatorGPA CalculatorStudent PortalCourse Outline
About
About usPrivacy PolicyReportContact
Notes
Past Papers
Blogs
Todo
Analytics
    Current Subject
    🧩
    Computer Organization and Assembly Language
    COMP3137
    Progress0 / 73 topics
    Topics
    1. Introduction to Computer Organization2. Assembly Language3. Comparison of Low-Level and High-Level Languages4. Register Types (16-bit): General Purpose and Special Purpose Registers5. Introduction and Usage of RAM6. Processor7. Registers8. System Bus9. Instruction Execution Cycle10. Assembly and Machine Language11. Assembler12. Linker and Link Libraries13. Programmer's View of a Computer System14. RISC and CISC Architecture15. Physical Address Calculation16. Basic Memory Organization17. CPU Organization18. Top Level View of Computer Function and Interconnection19. Assembler Instruction Cycle20. Execute Cycle21. Interrupts22. Interrupt Cycle23. Memory Connection24. Input/Output Connection25. CPU Connection26. MASM27. MIPS28. Defining Data in MASM Assembler29. Elements of Assembly Language30. Integer Constants31. Integer Expressions32. Real Number Constants33. Character Constants34. String Constants35. Reserved Words36. Identifiers37. Directives38. Instructions39. The NOP (No Operation) Instruction40. Adding and Subtracting Integer41. INC and DEC Instructions42. NEG Instruction43. How to Move Integer Number in Register44. Adding and Subtracting Numbers in Registers45. Declaration and Initialization of Variables46. Moving Data from Variable to Register47. Data Definition Statement48. BYTE and SBYTE Data49. WORD and SWORD Data50. Defining DWORD and SDWORD Data51. Knowledge about Different Data Types52. Operations, Array & Loops53. Division and Multiplication in Assembly54. Jumps Based on Specific Flags55. Jumps Based on Equality56. Simple Jump Statements57. Jumps Based on Specific Condition58. Code Examples59. Practice on MASM60. Procedures61. File Operations Procedures62. Labels in Procedures63. Stack64. Runtime Stack65. Conditional Control Flow Directives66. Compound Expressions67. Data Representation & Conversion68. Architecture69. Data Path70. Control Unit71. Critical Path72. General Principles of Pipelining73. Pipelined Y86 Implementations
    COMP3137›Programmer's View of a Computer System
    Computer Organization and Assembly LanguageTopic 13 of 73

    Programmer's View of a Computer System

    8 minread
    1,317words
    Intermediatelevel

    Programmer's View of a Computer System

    When programmers work with computers, they interact with a system that includes hardware, software, and various system components. A programmer's view of a computer system is centered on how these components work together to run programs and manage resources efficiently. Understanding this view is essential for writing efficient and optimized code, especially when working at low levels (like assembly language or system programming).

    In this context, the programmer's view involves abstracting the complexity of the hardware into concepts and tools that make it easier to develop software. These tools allow the programmer to focus on writing code, while the system takes care of executing it efficiently.


    Key Components in a Computer System (From a Programmer's Perspective)

    To understand how a programmer views the computer system, let's break it down into major components and how they interact with each other:

    1. CPU (Central Processing Unit):

      • The CPU is the brain of the computer, where program instructions are executed.
      • Registers inside the CPU store data that is actively used in calculations or to manage program control flow.
      • From a programmer’s perspective, the CPU performs instruction execution (such as arithmetic, logic operations, control flow), and it interacts with other parts of the computer system (memory, input/output devices).
    2. Memory (RAM - Random Access Memory):

      • RAM is where a program’s instructions and data reside while the program is running. It’s the primary storage for active programs.
      • From a programmer's point of view, memory is divided into regions:
        • Stack: Used for function calls, local variables, and maintaining execution context (like return addresses).
        • Heap: Used for dynamic memory allocation (memory that is allocated during program execution).
        • Data Segment: Contains global and static variables.
        • Text Segment: Holds the program code (machine instructions).
    3. Input and Output Devices (I/O):

      • I/O devices (such as the keyboard, mouse, display, printer, etc.) allow interaction between the user and the computer. Programmers write code that interacts with these devices, typically through system calls or I/O libraries.
      • I/O can be either synchronous or asynchronous, depending on whether the program waits for input/output operations to complete (blocking) or continues processing other tasks (non-blocking).
    4. Storage (Secondary Memory):

      • Secondary storage (hard drives, SSDs) provides persistent storage for data and programs. It’s slower than RAM but retains data even when the power is turned off.
      • Programmers typically work with files on the disk, reading and writing data for long-term storage. Data structures such as files, directories, and file systems are crucial here.
    5. System Bus:

      • The system bus is the communication pathway through which the CPU, memory, and I/O devices exchange data.
      • Programmers don't typically interact with the bus directly, but the performance and speed of the bus impact the efficiency of data transfer between components, which can affect program performance.
    6. Operating System (OS):

      • The Operating System is a crucial software layer that manages hardware resources and provides services for program execution.
      • The OS provides abstractions (like virtual memory, processes, threads, and system calls) that make it easier for programmers to interact with hardware without needing to manage every detail manually.
      • Programmers interact with the OS through APIs (Application Programming Interfaces) and system calls to perform tasks like memory allocation, file handling, and process management.

    Programmer's Interaction with the System

    1. Writing Code:

    • Programmers typically write in high-level programming languages (e.g., C, Java, Python), which abstract away the complexity of directly interacting with the hardware.
    • However, when performance or low-level control is needed, programmers may write in lower-level languages like C (which allows for direct memory manipulation) or even assembly language (which corresponds closely to machine code).

    2. Compilation and Linking:

    • The program code (written in high-level languages) is converted into machine-readable code using a compiler. The compiler translates the program into an object file (machine code), which is then linked by a linker to create an executable.
    • In this process, the compiler and linker handle symbol resolution (mapping function calls to their definitions), address binding (allocating memory locations), and other steps to prepare the program for execution.

    3. Memory Management:

    • Memory management is handled by the operating system in most high-level programming languages, which provide abstractions like heap and stack memory.
    • Low-level languages like C allow programmers to manage memory explicitly using pointers and dynamic memory allocation (e.g., using malloc and free).
    • Garbage collection (in languages like Java, Python, etc.) helps automatically manage memory by reclaiming unused memory.
    • Programmers need to be aware of potential issues like memory leaks (failing to free memory) and segmentation faults (accessing invalid memory locations).

    4. Input/Output Operations:

    • Programmers interact with I/O devices using system calls or library functions.
    • For example, writing to the screen is done via system calls in lower-level languages, or through standard libraries in higher-level languages (e.g., printf() in C or print() in Python).
    • File handling involves interacting with storage via I/O system calls (e.g., open(), read(), write() in C) or higher-level abstractions like streams in Java or Python.

    5. Multitasking and Concurrency:

    • Modern computers support running multiple tasks or processes concurrently. The operating system schedules these processes and manages the CPU's time.
    • Programmers write programs that can run in parallel (multi-threading) to take advantage of modern multi-core processors.
    • Concepts like processes, threads, synchronization (using locks or semaphores), and deadlock are important when writing concurrent programs.

    Abstractions from Hardware to Software

    A key aspect of a programmer's view of a computer system is that the operating system provides abstractions that shield the programmer from having to manage the hardware directly. Here are a few examples of these abstractions:

    1. File System: Programmers don't have to worry about where files are physically stored on disk or how to manage data at the block level. The OS provides a file system abstraction that allows programmers to work with files as logical entities.

    2. Virtual Memory: Virtual memory allows a program to use more memory than physically available by swapping data to disk. This abstraction makes programming easier by giving the illusion that the program has access to a large, continuous memory space, even though the physical memory is limited.

    3. Process Management: The OS abstracts the complexity of managing multiple processes running at once. Programmers interact with processes through APIs to create, schedule, and terminate processes. The OS ensures that processes do not interfere with each other by providing process isolation and memory protection.

    4. Network Stack: Programmers can access remote resources (e.g., databases, web servers) through network protocols without needing to manage the underlying hardware details. The operating system and network stack handle lower-level tasks like TCP/IP packet routing, error checking, and data encoding/decoding.


    Summary: Programmer's View of a Computer System

    • CPU: The processor executes instructions. Programmers see it as executing the logic of their program through instructions, registers, and control flow.

    • Memory: RAM is used to store the program’s instructions and data. Programmers are concerned with how to efficiently allocate and access memory, using concepts like the stack, heap, and static memory.

    • Operating System: The OS abstracts the underlying hardware and provides services such as file systems, process management, memory management, and I/O handling. Programmers interact with the OS through system calls and APIs.

    • I/O Devices and Storage: Programmers write code that interacts with I/O devices and files, but the underlying hardware interaction is abstracted by drivers and the OS.

    • Compilation and Linking: Programmers write code in high-level languages, which is compiled and linked to produce an executable program.

    In summary, the programmer’s view is based on interacting with a set of abstractions (provided by the OS and programming languages) that make it easier to develop applications without needing to manage every hardware detail. These abstractions simplify the process of working with memory, files, I/O devices, and concurrency.

    Previous topic 12
    Linker and Link Libraries
    Next topic 14
    RISC and CISC Architecture

    Past Papers

    Open this section to load past papers

    Click on Show Past Papers to see past papers.
    On This Page
      Reading Stats
      Est. reading time8 min
      Word count1,317
      Code examples0
      DifficultyIntermediate