OS & CPU Architecture

Oct.06.2017 | 13m Read | ^DevOps

Computers (math machines) use a system of processors (math engines) and memory (info or data storage) to run software (instructions). The Operating System or OS (foundation software) acts as the middleman between the hardware (machinery) and other programs (software units).

Various software properties are remote or distributed deploy, custom embedded devices, and multiprocessing by juggling hardware features. We shall start at the beginning from machine off and cover all the way to remote cloud computing and Artificial Intelligence (AI). Time to dive in!


▼ BIOS (Basic Input/Output System):

    • ☑⁡⁡ Instructions communicate with each other using the settings inside the CMOS ("see-moss" or Complementary Metal Oxide Semiconductor).
      ☑⁡ Located on the motherboard (or mainboard which other boards and devices connect to).
      ☑⁡⁡ Uses a flash chip ROM (Read-Only Memory is slow, but does not require constant electricity).
        ◆ Flash ROMs typically lasts 10 years.
        ◆⁡⁡ Wears out due to data overwrites (flashes).
        ◆⁡⁡ An interrupted flash (data write) can permanently destroy the device, bricking it. The unresponsive hardware then becomes 'as useful as a brick'.
  • ▼ CMOS (Complementary Metal Oxide Semiconductor):

    • ☑⁡⁡ A board chip that stores BIOS instructions.
      ☑⁡⁡ Uses Static Random Access Memory or SRAM which is faster than ROM, but requires electricity (often 128k bytes on-chip, kept alive by a wrist watch-like battery).
      ☑⁡⁡ This CMOS battery lasts 3-5 years, then resets the BIOS and your settings (including date and time) to default every restart until it is replaced.
      ☑⁡⁡ Many boards have a backup CMOS for alternate settings and in the case of data corruption.
        ◆ Set by jumper pins (removing or 'jumping' plastic covers on board pins).
  • ▼ Registers (the fastest RAM):

    • ☑⁡⁡ Registers inside the processors, are loaded from caches of SRAM to process data (load programs into memory and run them).
    • ☑⁡⁡ Power management is started (electricity is sent to various parts of the system from the power supply).

    ▼ POST (Power-On Self-Test):

    • ☑⁡⁡ Tests hardware components to determine the system's boot fitness.
      ☑⁡⁡ Feedback from beep code sounds (like a single short for pass) or LED light blinks and colors.
  • Boot (Bootstrap Load):

    ▼ Boot Loader (Bootstrap Loader program):

    • ☑⁡⁡ On successful POST, the system 'bootstraps' or pulls itself together.
        ◆ The ROM (Read-Only Memory) device and memory location within where the Operating System loading instructions are accessed (like the boot sector on a hard disc).
        ◆ The core of the OS (the kernel) is loaded and starts itself.
  • Operating System (OS):

    ▼ Device Drivers

    • ☑⁡⁡ Various drivers (hardware instructions) are loaded into a combo of kernel mode (or kernel space) and user mode (or user space).
      ☑⁡⁡ Kernel mode: better performing, high-access and privileged processes (located on ring 0 in the protection ring).
      ☑⁡⁡ User mode: protected and less privileged access processes, trading stability for speed vs the Kernel (drivers are typically located at ring 1 or 2 and apps are on ring 3+).
        ◆ NOTE: moving data between spaces and modes is very slow and hardware intensive.
      ☑⁡⁡ Virtual Device Drivers: emulated hardware (like DOS and VM ware) have access to device systems such as IRQs.
  • ▼ Process Management (running instructions):

    • ☑⁡⁡ Multitasking (multiprogramming):
        ◆ Parallel processing:
          ☑ Multi-core processors (each core can be assigned tasks to process).
          ☑ Bridging processors.
          ☑ Distributed system or nodes (multiple machines divide up the task processing).
        ◆ Specialized bus architecture:
          ☑ Pipes optimized for parallel data (tasks) flow.
      ☑ Pipes/Units optimized for parallel micro-instructions.
        ◆ Interleaving processes.
      ☑⁡⁡ Process creation (program is executed or instanced into memory):
        ◆ Process batches.
        ◆ Process node parent/child spawning (parent processes create or spawn child processes. Like a File System parent opens a Web Browser). Uses a tree-like structure for display and management.
      ☑⁡⁡ Process termination:
        ◆ Batch halt instructions (stop a group of instructions).
        ◆ Hardware errors (resolve and display as needed).
        ◆ Software errors (resolve and display as needed).
        ◆ User instructions (with scripts or an input device).
        ◆ Process completed.
      ☑⁡⁡ Two-state process model:
        ◆ RUNNING.
        ◆ NOT RUNNING.
      ☑⁡⁡ Three-state process:
        ◆ RUNNING.
        ◆ READY (queued or in a line).
        ◆ BLOCKED (requires event handling or processing to change state).
      ☑⁡⁡ Five-state process: swapping or 'suspending' states into buffers for efficiency:
        ◆ RUNNING.
        ◆ READY (queued).
        ◆ BLOCKED (requires event handling to change state).
        ◆ READY SUSPEND (READY process loaded into a swap buffer).
        ◆ BLOCKED SUSPEND (BLOCKED process loaded into a swap buffer).
      ☑⁡⁡ Interrupt Requests (IRQs, aka 'Interrupts'):
        ◆ The systems that manages and interleaves device processes with system processes.
          IRQ lines send messages from hardware to the CPU (Central Processing Unit) to 'interrupt' or take priority.
            ◆ Interrupt Handler: the program that loads the interrupt and processes it.
            ◆ Used for cabled devices (like USB keyboard, mouse, or hard drive) and internal cards (like video or sound).
            IRQs are numbered and can be set in the BIOS to avoid conflicts between devices.
            ◆ Newer devices may have dedicated Interrupt Controllers and/or support IRQ sharing.
            Plug and Play: the system of auto-configuring IRQs when devices are connected.
  • ▼ File system

    • ☑⁡⁡ Provides a directory/folder structure:
        ◆ Uses tables and/or nodes for look-up.
        ◆ Examples include NTFS and FAT (Windows), HFS and HPFS (Apple), EXT, XFS (Linux).
        Metadata: extra data for tagging and managing files (like attributes on Windows).
      ☑⁡⁡ User Interface (UI): provides tools for manipulating files:
        ◆ Text based: uses typed commands with typing devices (like keyboards or touchscreens).
        Graphical User Interface (GUI "goo-ee"): uses a pointer device (like a mouse or touchscreen).
  • ▼ Memory Management

    • ☑⁡⁡ Virtual Memory: page swapping hard disk ROM with RAM to increase the available resources for processing.
        ◆ Levels of memory:
          ☑⁡⁡ OS memory: pre-cached and makes the OS and UI more responsive.
          ☑⁡⁡ ⁡Application memory: garbage collection exited processes.
            ◆ Improves application performance if the OS has plenty.
  • ▼ Input/Output (I/O)

    • ☑⁡⁡ Memory mapped I/O interfaces and abstractions for the Bus and IRQs:
        ◆ Channel I/O: software based DMA with more options.
        ◆ Port-mapped I/O: port number assignment and management.
  • ▼ Networking

    • ☑⁡⁡ Software based networking hardware:
        ◆ Topology: network shapes such as star which has a central computer (like in cloud computing) or a mesh in which all computers are equal (like dial-up bulletin boards or peer-to-peer sharing apps).
        ◆ Routing: data trafficking.
        ◆ Packet management: packing and inspection off data packets.
        ◆ Port mapping (or port forwarding)L open/close data gateways.
        ◆ Protocol configuration: set the system for data communication (like TCP/IP, UDP, or HTTPS).
      ☑⁡⁡ Providing a visual interface for networking hardware.
  • ▼ Security

    • ☑⁡⁡ Integrity:
        ◆ Vulnerability patch fixes.
      ☑⁡⁡ Integrated tools:
        Malware (harmful software) removal.
        Firewall (port blocker) and net traffic monitoring and control.
        ◆ Network encryption (data masking).
      ☑⁡⁡ Filesystem:
        ◆ Local encryption.
        ◆ User/privilege metadata.
      ☑⁡⁡ UI for software tools:
      ☑⁡⁡ UI for hardware tools:
        ◆ Like Oracle's hardware-based firewall.
  • CPU (Central Processing Units):

    ▼ CPU Concurrency (Synching or Timing Operations):

    • ☑⁡⁡ Single Core/non-distributed:
        ◆⁡⁡ Programmed Threads and Bus architecture divide up the work.
          ☑⁡⁡ bridges (bus bridges): hardware connecting multiple buses.
        ◆⁡⁡ Absent such hardware, the CPU can interleave a schedule of instructions to share and manage resources.
        ◆⁡⁡ Thread states & lifecycle:
          #1 new thread -> runnable (new to ready).
          #2+ runnable -> <- blocked (back and forth).
          #2+ runnable -> <- waiting (back and forth).
          #2+ runnable -> <- timed waiting (back and forth).
          #End runnable -> terminated.
      ☑⁡⁡ Multi-core/distributed systems:
        ◆⁡⁡ Threads and servers divide up the work per node or core.
        ◆⁡⁡ Race condition: when multiple threads race to access the same data (which can cause a conflict in its value).
        ◆⁡⁡ Mutexes ("mew-texes"): a thread must call unlock() and edit (or mutate) the data before lock() to prevent another thread from causing a race condition.
      ☑⁡⁡ Overclocking Processors (CPUs and GPUs) by setting the clock speed higher:
        ◆⁡⁡ Can cause thread concurrency to drop, leading to more errors and worse performance.
        ◆⁡⁡ Also causes OS freezes/crashes, heat damage, screen flickers, 'random' behavior, and errors.
        ◆⁡⁡ Processor overclocking settings and performance depends on the specific model and hardware modding abilities (like increasing cooling).
  • ▼ Assembly Language & Machine Language:

    • ☑⁡⁡ Machine Language (ML or Machine Code): a low level language consisting of binary (so 154 as 10011010) or hex (154 as 9A).
        ◆ Higher level languages compile down into this.
        ◆ Generally this is the level just above vendor based hardware instructions or microcode.
      ☑⁡⁡ Assembly language (asm): assembles machine code.
        ◆ Uses opcodes (like AAA for addition) to manage and interface with hardware instructions.
        ◆ Ideal for specialized hardware tasks that removes much of the cruft and safeguards.
        ◆ Generally the lowest level a human programs outside of hacks and analog methods.
  • GPU (Graphics Processing Units):

    ▼ GPUs & AI:

    • ☑⁡⁡ Offloading intensive processing required in Machine Learning (solution training for AI) to more specialized hardware (GPUs).
      ☑⁡⁡ APIs (App Programming Interfaces like Vulkan, Direct3D, CUDA) efficiently and cost-effectively link together GPUs.
      ☑⁡⁡ GPUs typically have faster RAM (known as VRAM or Video RAM).
        ◆ Nvidia in particular has Tensor Cores that operate as AI hardware first and foremost.
        ◆ Nvidia DGX model workstations/servers comprise multiple cards that specialize in AI processing.
        ◆ Nvidia Jetson is a specialized and relatively cheap palm-sized computer for AI training.
        ◆ Nvidia NGC now has cloud based servers for GPU AI training.
        ◆ Nvidia NGX features hybrid cloud technology.
  • Cloud Computing:

    ▼ Origin:

    • ☑⁡⁡ Tested commercially by Remote Job Entry using the OS/360 mainframe (large computer) and terminals (smaller computers that used mainframes) hardware from IBM (1960's).
    • ☑⁡⁡ Cloud symbols have been in use since 1977 to refer to networks.
    • ☑⁡⁡ The first commercial cloud computing platform comes from Apple's General Magic using web tablets with mini-touchscreens and a stylus (like the Motorola Envoy in 1994). These provided streaming video, plus online games and shopping on the Magic Cap Operating System.

    ▼ PaaS (Platform as a Service):

    • ☑⁡⁡ In 2006 Amazon forms Amazon Web Services (AWS) and releases Elastic Compute Cloud (EC2), allowing customers to host a variety of online apps (SaaS or Software as a Service).
      • AWS ecosystem.
    • ☑⁡⁡ Google's App Engine (GAE) enters beta in 2008.
      • GCP (Google Cloud Platform) ecosystem.
    • ☑⁡⁡ Other PaaS options now include Amazon Lighsail (EC2), Heroku (EC2), Netlify (EC2), and GitHub (Microsoft Azure).

    ▼ IaaS (Infrastructure as a Service):

    • ☑⁡ Goes deeper and provides more, allowing users to build their own PaaS.
    • ☑⁡⁡ Amazon Web Services (AWS).
      • ◆ Developed to run Amazon (store), Prime Video (streaming), Alexa (smart appliance), and more.
      • ◆ The most popular and expanding business.
      • ◆ The most services in and out of development.
    • ☑⁡⁡ Google Cloud Platform (GCP).
      • ◆ Developed to run Youtube (streaming), Google (serach), Gmail (email), and more.
      • ◆ Overall slightly faster than AWS, but with less services.
      • ◆ Simple and more engineer-like terminology.
    • ☑⁡⁡ Microsoft's Azure takes .NET web hosting.
      • ◆ Developed to run Office 360 (productivity), Outlook.com (email), X-Box Live (games), and more.
      • ◆ More market share than GCP.
    • ☑⁡⁡ Other IaaS options now include Alibaba Cloud, Oracle Cloud, and IBM Cloud.

           : NEWS