Programming Java

An Introduction to Computer Science



1. Basic Computer System

What is a computer?

A basic computer system is composed of hardware and software.

Hardware refers to physical components of a computer system. Hardware can also refer to physical devices that connect to a computer system.

Input refers to information flowing into a computer system. Input device is a hardware that sends information to the computer system to process. A keyboard is an example of an input device.

Output refers to information flowing out of a computer system. Output device is a hardware that receives information that the computer system has processed. A monitor is an example of an output device.

Software refers to a computer program which is a collection of instructions that performs a specific task(s). The software that operates a computer system is called the “operating system”.

Figure 1A – Basic Computer System

What is a program?

A computer program or a program is a set of instructions to the computer system. It is said that a program is running or executing when the computer system carries out the instructions.

The instruction in a program is written in programming languages or codes. Java is a programming language. Programming or coding is the act of writing such instructions.

A person who writes or develops a computer program is called “programmer” or “developer”.

A person who makes use of the finished computer program is called “user” or “end-user”.


In-Depth Knowledge


Computer System

A decade or so ago, computers were generally known as PCs (personal computers). In present times, computers come in many form factors: tablet, smartphone, game console, gaming device, smart TV, smart speaker, etc. All of these have hardware and software that make up a computer system.

Hardware

The hardware of a general computer system consists of Input, Output, Central Processing Unit (CPU), Memory and Storage.

Input is an interface for information flowing into the system via input devices. Input devices include keyboard, touch screen, game controller, microphone, etc.

Output is an interface for information flowing out of the system via output devices. Output devices include computer monitor, printer, screen, speaker, etc.

CPU is the brain of the computer system. It receives information via input interface, processes it, and sends out the processed information via output interface. CPU is a simple brain in that its capabilities are limited to the purpose of a system. In a basic system, it can carry out arithmetic operations and logical operations. CPU is the part that executes the instructions in a computer program.

Main memory is where the CPU stores the instructions and additional information required while executing the computer program. The main memory is also called “RAM” (Random Access Memory). The information in the main memory is lost when the program ends, or the system is turned off. This information is temporary.

Secondary memory is where the CPU stores information for retrieval at a later time. The secondary memory is also called “storage”. Hard drive, SD card, USB drive, online drive are examples of a storage. The information in the secondary memory remains even after the program ends or the system is turned off. This information is permanent until the user decides to delete the information.

Example:
Consider a game play scenario. The button you press on a game controller is translated to signals or codes and flow into the system. The system then processes this information and sends output. The screen receives this output and displays your game character running, for example. The current state of the game and the available lives are stored in the memory. When you exit the game, your rank and the last game stage are stored in the storage. When you restart the game, this information is retrieved from the storage so that you can pick up where you left off.

Memory

The main memory is a long list of memory slots or locations. The memory locations are numbered, and the numbers are called “memory addresses”. Think of a row of storage lockers with each locker assigned a number. The main memory is called “Random Access Memory” because a memory location can be accessed randomly (vs. sequentially) via the memory address.

A computer system stores information as 0s and 1s (zeros and ones). The smallest piece of information is called a “bit”. A memory location typically consists of 8 bits which is called a “byte”. A memory address refers to a byte size of memory location. If the information cannot fit all in a single byte, the computer system uses adjacent byte(s). A computer system assigns preset number of bytes for each kind of information.

Memory size varies from system to system, but the memory size is always in some multiple of 8 bits (byte): 16 GB, 32 GB, 64 GB, etc.

  • 1 KB or kilobyte = 1000 × 1 byte
  • 1 MB or megabyte = 1000 × 1000 × 1 byte or 1000 × 1 KB
  • 1 GB or gigabyte = 1000 × 1000 × 1000 × 1 byte or 1000 × 1 MB

Software

Hardware by itself doesn’t do much. It’s the software that breathes life into the hardware and makes a computer system useful. The software refers to a computer program. A computer program is a collection of instructions that performs specific tasks. It can be a single program or a collection of mini programs.

The collection of mini programs that work together to operate a computer system is called an operating system. For example, Android and iOS are operating systems for mobile devices, and Windows and macOS are operating systems for desktop or laptop computers.

Figure 1B – Computer System and Computer Memory

2022 Copyright


By:


Design a site like this with WordPress.com
Get started