---
description: >-
  This section covers basic concepts related to System and Software. It also
  includes details about program execution, memory, types of storage and
  Kernel/User modes.
---

# Software Systems

### W**hat is a System?**

It is a set of instructions working together as parts of a mechanism or an interconnecting network, a complex whole. It is also a set of principles or procedures accordingly to which things are accomplished as an organized scheme or method.&#x20;

A system can be“Natural” or “Engineered”. Solar System is a natural system. A Telephone network system, power plants, etc. are Engineered. An Engineered system is typically built using a structured design, skilled teams, thoroughly reviewed processes or programs, and efficient communication among all the stakeholders. All Systems have boundaries. These boundaries define the scope and intent of a particular system.

### **What is Software?**&#x20;

Computer programs and associated documentation. Software products may be developed for a particular customer or may be developed for a general market. It is written using programming languages. A programming language has syntactic + semantic rules, otherwise called asSyntax, logical, and/or runtime errors. Programming languages are widely divided into three types.

1. **High-Level Language**  - A high-level language is a programming language designed to simplify computer programming. It is \`\`high-level'' since it is several steps removed from the actual code run on a computer's processor. High-level source code contains easy-to-read syntax that is later converted into a low-level language, which can be recognized and run by a specific computing device. C, C++, Java, Python are few examples.
2. **Assembly Language** - An assembly language is a low-level programming language designed for a specific type of processor. It may be produced by compiling source code from a high-level programming language (such as C/C++) but can also be written from scratch. Assembly code can be converted to machine code using an assembler. mnemonic-based based codes like ADD, SUB, MOV etc.
3. **Low-Level Language** - A low-level language is a programming language that provides little or no abstraction of programming concepts and is very close to writing actual machine instructions. Two examples of low-level languages are assembly and machine code. Native Language of Computer Circuitry is one example of a low-level language.

### Program Execution

Most programs are written by programmers are in a high-level language such as C, Perl, or Java. Just as a human language makes it easy for people to communicate with one another, so computer languages simplify the job of telling a computer what to do. However, because a computer only understands numbers, talking to one is like speaking to someone with whom you don't share a language. You need a translator to properly communicate, and that's what interpreters and compilers do. Compiler and Interpreter are two different ways to execute a program written in a programming or scripting language.

**Compiler** - It takes entire program and converts it into object code which is typically stored in a file. The object code is also referred to as binary code and can be directly executed by the machine after linking. Compiled languages are used for developing application software. C and C++ are examples.

**Interpreter** - directly executes instructions written in a programming or scripting language without previously converting them to object code or machine code. Interpreted languages are used for developing system software. Perl and Python are examples.

**Software System** - It is engineered and can be defined as a _"consists of a number of separate programs, configuration files, which are used to set up these programs, system documentation, which describes the structure of the system, and user documentation, which explains how to use the system"_. The practitioners involved with developing software products, i.e., the software that can be a customer are called \textit{Software Engineers}.

![Example of a Software System - UPI Payments - Source: NPCI](https://3903980405-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M_kux1uuaXhHbpyCSYu%2F-M_kwsmze9h_kOgrJEm7%2F-M_kwtYtsUMgvwKmyVT2%2Fupi.JPG?alt=media\&token=4788ffb2-1ec4-41c2-abd2-0ce6448d9a48)

The above figure describes the detailed overview of the [Universal Payment Interface (UPI)](https://www.npci.org.in/product-overview/upi-product-overview) developed by the National Payments Corporation of India. UPI is a system that powers multiple bank accounts into a single mobile application (of any participating bank), merging several banking features, seamless fund routing & merchant payments into one hood. It also caters to the \`\`Peer to Peer'' collect request, which can be scheduled and paid as per requirement and convenience. It is one good example of a comprehensive software system.

&#x20;**Basic Computing Device**  - Computing devices are electronic devices that take inputs, process the inputs, and then calculate results from the inputs. These are the mathematical devices that can do math much in a faster way. One of the most prevalent computing devices is the computer which we all know about it. A primary computing device should contain an Input/Output Unit, a memory unit (can be primary/secondary/tertiary), a processing unit, and interconnecting structures. The computation power of a computing device can be assessed based on the Organization of Hardware, Mode of processing, Storage, Speed, Complexity, Control Mechanism, Resilience.

![A Basic Computer Architecture](https://3903980405-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M_kux1uuaXhHbpyCSYu%2F-M_kwZcDT5vK3zuXayrL%2F-M_kwehZfedTXWeDJAr7%2Fmem.jpg?alt=media\&token=7fa8bcf1-1216-4623-9095-27119e0032a6)

The above figure is the architecture of a basic computer. It includes CPU - refers to Central Processing Unit, I/O module for Input/Output processing, Main Memory for loading instructions, and System Bus which acts as connectors of all these components. A CPU primary contains the following parts -&#x20;

1. **PC - program counter** is a register in a computer processor that contains the address (location) of the instruction being executed at the current time. As each instruction gets fetched, the program counter increases its stored value by 1.&#x20;
2. **IR - Input Register** is a register that accepts input information from a computer at one speed and supplies the information to the central processing unit at another speed, usually much greater.&#x20;
3. **ALU - Arithmetic Logic Unit** is a digital circuit used to perform arithmetic and logic operations.&#x20;
4. **MBR - memory buffer register** stores the data being transferred to and from the immediate access store. It contains a copy of designated memory locations specified by MAR. It acts as a buffer allowing the processor and memory units to act independently without being affected by minor differences in operation.&#x20;
5. **MAR - memory address register** is the CPU register that either store the memory address from which data will be fetched to the CPU, or the address to which data will be sent and stored. In other words, MAR holds the memory location of data that needs to be accessed.&#x20;

### Memory Storage

There are hardware storage devices which store data based on their capabilities. These devices are broadly divided into Primary and Secondary memory storage types.&#x20;

**Primary Memory** includes ROM and RAM, and is located close to the CPU on the computer motherboard, enabling the CPU to read data from primary memory very quickly indeed. It is used to store data that the CPU needs imminently so that it does not have to wait for it to be delivered.&#x20;

**RAM** - The data stored in random access memory can be accessed as the name suggests in any random order. Or, put another way, any random bit of data can be accessed just as quickly as any other bit.&#x20;

1. **DRAM**: DRAM stands for Dynamic RAM, and it is the most common type of RAM used in computers. The oldest type is known as single data rate (SDR) DRAM, but newer computers use faster dual data rate (DDR) DRAM. DDR comes in several versions including DDR2, DDR3, and DDR4, which offer better performance and are more energy-efficient than DDR. However different versions are incompatible, so it is not possible to mix DDR2 with DDR3 DRAM in a computer system. DRAM consists of a transistor and a capacitor in each cell.&#x20;
2. **SRAM**: SRAM stands for Static RAM, and it is a particular type of RAM that is faster than DRAM, but more expensive and bulker, having six transistors in each cell. For those reasons, SRAM is generally only used as a data cache within a CPU itself or as RAM in very high-end server systems. A small SRAM cache of the most imminently-needed data can result in significant speed improvements in a system.&#x20;
3. The key difference between DRAM and SRAM is that SRAM is faster than DRAM - perhaps two to three times faster - but more expensive and bulkier. SRAM is usually available in megabytes, while DRAM is purchased in gigabytes. DRAM uses more energy than SRAM because it constantly needs to be refreshed to maintain data integrity, while SRAM - though volatile – does not need constant refreshing when it is powered up.&#x20;

**ROM** stands for read-only memory, and the name stems from the fact that while data can be read from this type of computer memory, data cannot normally be written to it. It is a very fast type of computer memory that is usually installed close to the CPU on the motherboard. ROM is a type of non-volatile memory, which means that the data stored in ROM persists in the memory even when it receives no power – for example when the computer is turned off. In that sense, it is similar to secondary memory, which is used for long-term storage. ROM is available in several different types, including PROM, EPROM, and EEPROM&#x20;

1. **PROM**: PROM stands for Programmable Read-Only Memory, and it is different from true ROM in that while a ROM is programmed (i.e. has data written to it) during the manufacturing process, a PROM is manufactured in an empty state and then programmed later using a PROM programmer or burner.
2. **EPROM**: EPROM stands for Erasable Programmable Read-Only Memory, and as the name suggests, data stored in an EPROM can be erased and the EPROM reprogrammed. Erasing an EPROM involves removing it from the computer and exposing it to ultraviolet light before re-burning it.&#x20;
3. **EEPROM**: EEPROM stands for Electrically Erasable Programmable Read-Only Memory, and the distinction between EPROM and EEPROM is that the latter can be erased and written to by the computer system it is installed in. In that sense, EEPROM is not strictly read-only. However in many cases, the write process is slow, so it is normally only done to update program code such as firmware or BIOS code on an occasional basis&#x20;

**Secondary Memory** is usually physically located within a separate storage device, such as a hard disk drive or solid-state drive (SSD), which is connected to the computer system either directly or over a network. The cost per gigabyte of secondary memory is much lower, but the read and write speeds are significantly slower. They are Hard disk drives, solid-state drives (SSDs), Optical (CD or DVD) drives, Tape drives, Pen Drives, Memory sticks, Storage arrays including 3D NAND flash arrays connected over a storage area network (SAN), Storage devices that may be connected over a conventional network (known as network-attached storage, or NAS), Cloud-based storage are also considered as secondary storages.

### Understanding Software Types

**System Software** - The operating system is a type of system software kernel that sits between computer hardware and end-user. Systems Software is an application that is designed specifically for running the hardware device on a personal computer and is used to maintain a platform for Application Software to be used. It is designed to communicate with the internal parts of your computer such as the hard drive, RAM, ROM, cache, microprocessors, etc. so that the user doesn't have to. It contains all of the drivers necessary for this type of communication and, in the simplest sense, it is the interface between the user and the hardware. It is the software that runs in the background and brings the separate physical parts of the computer together in order to provide the seamless stream of activity that a user experiences. Some of its responsibilities include the transfer of data between the memory and disks (on the hard drive) as well as providing the information needed to display icons, text, cursors, and other visible necessities on the display screen.&#x20;

**Application Software** - Application Software is the most common program that runs in the foreground of the computer. They tend to perform useful tasks that are not associated with computer maintenance, system boot-up, or hardware communication. Application software is directly reliant on the Systems Software to communicate to the physical components of the computer and cannot operate without it. If you were to visualize this, the Application Software would operate on top of the Systems Software and would be the most visible to the user while the Systems Software would remain in the background unnoticed. The Systems Software would then communicate to the Hardware on its behalf and deliver any information to it from the Application Software. In turn, any required information from the Hardware would pass through the Systems Software to the Application Software. Application Software is the most familiar form of software and comes in a variety of types. Most often, they can be accessed through the graphical user interface of the operating system being used by double-clicking on an icon. Some of the most famous examples include word processors, spreadsheets, photo-editing programs, database programs, and accounting programs, etc.&#x20;

### Operating System

A set of software that manages computer hardware resources and serves other programs. It is low-level software that supports a computer's basic functions, such as scheduling tasks and controlling peripherals. Examples – Windows, Unix, BSD, Linux, OS X, iOS, ChromeOS, Android, etc. Below is the classification of Operating Systems:&#x20;

1. **Multi-user**: Allows two or more users to run programs at the same time. Some operating systems permit hundreds or even thousands of concurrent users.&#x20;
2. **Multiprocessing**: Supports running a program on more than one CPU.&#x20;
3. **Multitasking**: Allows more than one program to run concurrently.&#x20;
4. **Multithreading**: Allows different parts of a single program to run concurrently.&#x20;
5. **Real time**: Responds to input instantly. General-purpose operating systems, such as DOS and UNIX, are not real-time. \end{itemize}&#x20;

**Bootstrap Program** - A bootstrap program is the initial program that the computer runs when it is powered up or rebooted. It initializes all aspects of the system, from CPU registers to device controllers to memory contents. The bootstrapping process does not require any outside input to start. Any software can be loaded as required by the operating system rather than loading all the software automatically.

![Step-by-Step process of Bootstrap program](https://3903980405-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M_kux1uuaXhHbpyCSYu%2F-M_kw8fQwGUcD2hcYJ3u%2F-M_kwAxADRflkqxc-rnW%2Fboot.jpg?alt=media\&token=c3a65536-1c46-42c5-862e-5c780feab39f)

As shown in the above figure, The bootstrapping process is performed as a chain i.e. at each stage, it is the responsibility of the simpler and smaller program to load and execute the much more complicated and larger program. This means that the computer system improves in increments by itself. The booting procedure starts with the hardware procedures and then continues onto the software procedures that are stored in the main memory. The bootstrapping process involves self-tests, loading BIOS, configuration settings, hypervisor, operating system, etc. Without bootstrapping, the computer user would have to download all the software components, including the ones not frequently required. With bootstrapping, only those software components need to be downloaded that are legitimately required and all extraneous components are not required. This process frees up a lot of space in the memory and consequently saves a lot of time.&#x20;

### Kernel Mode & User Mode

&#x20;A processor in a computer running any operating system has two different modes: **user mode** and **kernel mode** as shown in figure below. The processor switches between the two modes depending on what type of code is running on the processor. Applications run in user mode, and core operating system components run in kernel mode. While many drivers run in kernel mode, some drivers may run in user mode.

<div align="center"><img src="https://3903980405-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M_kux1uuaXhHbpyCSYu%2F-M_kvtPfa2kBcCUOqABE%2F-M_kw20CgFjLz_hAPFO5%2Fmode.jpg?alt=media&#x26;token=823062e3-fb5c-4036-acb0-6ef68e97e4e6" alt="Understanding Kernel and User mode"></div>

When you start a user-mode application, the operating system creates a process for the application. The process provides the application with a private virtual address space and a private handle table. Because an application's virtual address space is private, one application cannot alter data that belongs to another application. Each application runs in isolation, and if an application crashes, the crash is limited to that one application. Other applications and the operating system are not affected by the crash.

In addition to being private, the virtual address space of a user-mode application is limited. A processor running in user mode cannot access virtual addresses that are reserved for the operating system. Limiting the virtual address space of a user-mode application prevents the application from altering, and possibly damaging, critical operating system data.

All code that runs in kernel mode shares a single virtual address space. This means that a kernel-mode driver is not isolated from other drivers and the operating system itself. If a kernel-mode driver accidentally writes to the wrong virtual address, data that belongs to the operating system or another driver could be compromised. If a kernel-mode driver crashes, the entire operating system crashes.&#x20;

### Interfaces

Interfaces the screens that deal with two things - the way software and hardware interact and how either would interact with a person i.e. the user.&#x20;

* **CUI** - CUI stands for Character User Interface. This is a type of user interface where the user interacts with computer using the only keyboard. To perform any action command is required. CUI is a precursor of GUI and was used in most primitive computers. Most modern computers use GUI and not CUI. Eg: MS-DOS has CUI.&#x20;
* **GUI** - GUI stands for Graphical User Interface. This is a type of user interface where the user interacts with the computer using graphics. Graphics include icons, navigation bars, images, etc. The mouse can be used while using this interface to interact with the graphics. It is a very user-friendly interface and requires no expertise. Eg: Windows has GUI.
