DEV Community

Cover image for Computer science 101: Hardware vs software components
Hunter Johnson for Educative

Posted on • Originally published at educative.io

Computer science 101: Hardware vs software components

Hardware and software are essential parts of a computer system. Hardware components are the physical parts of a computer, like the central processing unit (CPU), mouse, storage, and more. Software components are the set of instructions that we store and run on our hardware. Together, they form a computer.

If you are new to computer science, it's important to understand hardware and software components. This is the foundation of any computer science journey.

Today, we will be diving into hardware and software and teach you how they relate to a computer's memory, CPU, and more.

Today, we will learn:

Hardware vs. Software

Software describes a collection of programs and procedures that perform tasks on a computer. Software is an ordered sequence of instructions that change the state of a computer's hardware. There are three general types of software:

  • System software
  • Programming software
  • Application software

When you think of computer science, software is probably what comes to mind. Software is what developers actually code. Those programs are then installed onto a hard drive.

Hardware is anything physically connected to a computer. For example, your display monitor, printer, mouse, and hard drive are all hardware components.

Hardware and software interact with each other. The software "tells" the hardware which tasks to perform, and the hardware makes it possible to actually perform them.

Note: Most computers require at least a hard drive, display, keyboard, memory, motherboard, processor, power supply, and video card to function.

Hardware vs software

Hardware components

Now that we understand the difference between hardware and software, let's learn about the hardware components of a computer system. Remember: hardware includes the physical parts of a computer that the software instructs.

CPU

The Central Processing Unit (CPU) is a physical object that processes information on a computer. It takes data from the main memory, processes it, and returns the modified data into the main memory. It is comprised of two sub-units:

  • The control unit (CU): controls data flow from and into the main memory
  • The arithmetic and logic unit (ALU): processes the data

Von Neumann architecture

This computer architecture design, created by John von Neumann in 1945, is still used in most computers produced today. The Von Neumann architecture is based on the
concept of a stored-program computer. Instruction and program data are stored in the same memory.

This architecture
includes the following components:

  • Control Unit
  • Inputs/Outputs
  • Arithmetic and Logic Unit (ALU)
  • Memory Unit
  • Registers

Von Neumann architecture

Input and output units

The input unit takes inputs from the real world or an input device and converts that data into streams of bytes. Common input devices include a keyboard, mouse, microphone, camera, and USB.

The output unit, on the other hand, takes the processed data from the storage of CPU and represents it in a way a human can understand. Common output devices include a monitor screens, printers, and headphones.

Storage Units

After the data is retrieved and converted, it must be stored in the memory. The storage unit or memory is the physical memory space. It is divided into byte-sized storage locations.

Storage units example

A storage contains millions of bytes of memory to store anything we want on our computer. To store a bit of data in computer memory, we use a circuit, called a latch, that stores the previous input unless it's reset. We can create a circuit using a:

  • S-R latch
  • Gated S-R latch
  • D latch

Memory

There are components to a computer's hardware memory. Main memory or random access memory (RAM) is the physical memory space inside a computer. It stores data and instructions that can directly be accessed by the CPU. Computers usually have a limited amount of main memory to store all your data.

That is when secondary storage comes into use. Secondary storage augments the main memory and holds data and programs that are not needed immediately.

Secondary storage devices include hard drives, compact discs (CD), USB flash drives, etc. Secondary storage devices cannot be directly accessed by the CPU.

Software components

Now let's discuss the different software components that we need to have a functioning computer. Remember: software comprises the set of programs, procedures, and routines associated needed to operate a computer.

Machine language

A computer can only process binary: a stream of ones and zeros. Binary is the computer’s language. Instructions for the computer are also stored as ones and zeros that the computer must decode and execute.

Assembly language

Assembly language is a human-readable instruction mode that translates binary opcode into assembly instruction. A CPU cannot process or execute assembly instructions, so an encoder is required that can convert assembly language to machine language.

Assembler

An assembler translates an assembly language program into machine language. The code snippet below is an assembly program that prints “Hello, world!” on the screen for the X86 processor.

section .data
   text db 'Hello, world!'

section .text
   global _start              

_start:
   mov  rax, 1               
   mov  rdi, 1
   mov  rsi, text
   mov  rdx, 14
   syscall

   mov  rax, 60
   mov   rdi, 0
   syscall
Enter fullscreen mode Exit fullscreen mode

High-level languages

Assembly language is referred to as a low-level language because it's a lot like machine language. To overcome these shortcomings, high-level languages were created.

These are called programming languages, and they allow us to create powerful, complex, human-readable programs without large numbers of low-level instructions. Some of the most famous high-level languages are:

Example of "Hello World" in Python:

print "Hello World"
Enter fullscreen mode Exit fullscreen mode

How do you design software?

Software design is the process of transforming particular requirements into a suitable program using code and a high-level language. We need to properly design a program and system that meets our goals.

Developers use software design to think through all the parts of their code and system. Software design includes three levels:

  • Architectural Design: an abstract version of the program or system that outlines how components interact with each other.
  • High-level Design: this part breaks the design into sub-systems and modules. High-level design focuses on how the system should be implemented.
  • Detailed Design: this part deals with the implementation. This is here we define the logical structure of each module.

What to learn next

Congrats! You should now have a solid idea of hardware, software, and the components of a computer. These are essential to your foundation as a computer scientist. For your next step on this journey, you should learn about:

  • Binary conversions
  • Data representation
  • Data compression
  • Basic syntax of programming language

To get started with these foundations, check out Educative's course Information Representation in Computer Systems. This course is the perfect first step into the world of computer science. You'll learn how a computer system performs complex tasks, from storage to processing and beyond.

Happy learning!

Continue reading about computer science on Educative

Start a discussion

What other information is key for someone just starting their coding education? Was this article helpful? Let us know in the comments below!

Top comments (0)