Principles of Computer System Operation 🖥️
หลักการทำงานของระบบคอมพิวเตอร์
What a computer system is made of, how the CPU runs one instruction after another, and the devices that take data in, send results out and remember things. Every section, activity and exercise below follows the IPST textbook (book pp. 74–99).
🎯 Learning objectives จุดประสงค์ของบทเรียน
By the end of this chapter you can:
- ✅ Name the components of a computer system and understand what each one does.
- ✅ Explain how a computer system works.
- ✅ Give examples of computer systems applied in daily life.
In this chapter: 4.1 Components of a computer system · 4.2 How a computer system works · 4.3 Application software
💬 Chapter opener
Computer systems have developed continuously from the past to the present: from computers as big as a large room to ones small enough to carry around in many forms. Computers are conveniences that play a part in everyday life. They are made of hardware and software that must work together.
Software has grown from only counting or doing simple calculations to being able to “think”, show results, or even respond to people automatically.
Today small computers are embedded in devices all around us. They respond automatically or talk to each other over a network, for example security systems, drones, health-tracking wristbands and smart homes.
📖 Review before you start ทบทวนความรู้ก่อนเรียน
- Give examples of how computers are used in daily life.
- Look at the computer you use. Which peripheral devices are connected to it?
- Which programs have you used, and how could you group them?
- Paying with a QR code, online classes, booking a Grab, ATMs, traffic lights, smart TVs, health apps on a phone, the school's attendance system.
- A typical school PC: keyboard, mouse, monitor, speakers or headphones, webcam, microphone, printer, USB flash drive.
- One way to group them: system programs (Windows, Android, antivirus, file compression) and application programs for work (Word, Excel, Google Docs), learning (Scratch, Python), communication (LINE, email, browser) and fun (games, video). You will see this exact grouping in §4.1.2.
Users can usually work with a computer system without deep knowledge of its hardware or software, because the system is designed to hide the complicated details behind an interface that is easy to use. Still, if you understand how the hardware and software work inside, you can judge how capable each computer model is, and use computer systems to create work appropriately and efficiently.
🃏 Key-term flashcards Tap to flip
4.1 Components of a computer system องค์ประกอบของระบบคอมพิวเตอร์
A computer system has two main parts: hardware and software.
4.1.1 Hardware ฮาร์ดแวร์
Hardware means the physical parts of the computer and its devices. It is made of 3 units:
🧠 Central Processing Unit (CPU)
หน่วยประมวลผลกลาง
Does the calculating. It coordinates the work between the memory unit and the input/output unit so that everything follows the instructions.
💾 Memory and storage unit
หน่วยความจำและจัดเก็บ
Stores data, instructions and programs.
🎛️ Input/output unit
หน่วยรับเข้าและส่งออก
Takes data and instructions from outside into processing, and sends the results of processing back out.
4.1.2 Software ซอฟต์แวร์
Software is a program, or a set of programs, that controls the hardware so it can do things with data the way the user wants. There are 2 types:
1) System software ซอฟต์แวร์ระบบ has 2 parts:
- Operating system (OS) ระบบปฏิบัติการ: a set of programs that manages, controls and makes it easy to run application software through a user interface. It shares out the hardware to whatever the application software needs, efficiently, and provides services for using the hardware. OS examples for computers: macOS, Windows, Linux, Chrome OS. For mobile devices: Android, iOS.
- Utility programs โปรแกรมอรรถประโยชน์: programs that help the software and hardware run smoothly and make the hardware work better, such as network-support programs, programming-language translators, antivirus programs, file-backup programs, file-compression programs, and programs that diagnose and maintain the hardware.
2) Application software ซอฟต์แวร์ประยุกต์: programs that the user runs or tells to process something, such as maths or science calculators, accounting programs, games, animation and graphics programs, word processors, spreadsheets, web browsers, multimedia programs, chat programs, email programs, and programs that users write themselves.
Application software is normally installed in storage. When the user runs it, it is loaded into memory so it can be processed.
- Give examples of devices you know that use application software.
- Knowing what computer hardware and software can do, imagine what else a computer could do that would be useful to you.
- Smartphones (LINE, banking apps), smart TVs (YouTube, Netflix), smartwatches (step counter), car navigation (Google Maps), ATMs and ticket machines, game consoles.
- Example: an app that photographs my homework, checks the maths and explains each wrong step; a camera at the school gate that counts students and messages parents; a sensor in the classroom that turns on the fan when it gets hot.
🗂️ Sort it: hardware or which kind of software?
Read each item and choose where it belongs, using the groups from §4.1.
4.2 How a computer system works หลักการทำงานของระบบคอมพิวเตอร์
4.2.1 Central Processing Unit หน่วยประมวลผลกลาง
The central processing unit, or CPU (also just called the processing unit), processes the instructions of the user or of a program that are in memory. Fig 4.1 shows an example of a CPU.
A CPU has 3 parts that work together:
| Part | Thai | Job |
|---|---|---|
| Arithmetic Logic Unit (ALU) | หน่วยคำนวณและตรรกะ | Does arithmetic and logic on data. |
| Control Unit (CU) | หน่วยควบคุม | Coordinates memory, the ALU and the input/output unit so that the program's instructions are carried out. |
| Register | รีจิสเตอร์ | A place to hold data, like the CPU's scratch paper: it keeps results, or the instruction being processed, for a short time. |
Each instruction is processed in 3 sub-steps in a row, called a machine cycle วงรอบเครื่องจักร, controlled by the control unit. One machine cycle processes one machine-language instruction. Today's CPUs process many millions of instructions every second. (Some kinds of computer use machine cycles of 2, 4 or 5 steps instead.)
A machine instruction is a pattern of 0s and 1s (each digit is called a bit). It contains an operator, which says what to do with the data (add, subtract, compare…), and an operand, the data that is used in the processing.
The 3 steps of a machine cycle
- Fetch การนำคำสั่ง: bring one machine-language instruction from memory and keep it in a register, and add one to the instruction-address counter (the counter that says where the instruction for the next cycle is).
- Decode การถอดรหัส: translate the instruction into the small operations that must be done.
- Execute การกระทำการ: the ALU carries out those operations, and the result (if there is one) is stored in a register or in memory.
A processor usually has many registers, each with its own job. Besides the one that holds the instruction being worked on, there is one that tracks the address of the next instruction, one that holds results from the ALU, and one that holds data for the input/output unit.
A machine-cycle example from IPST: oho.ipst.ac.th/machineCycle
🎮 Step through machine cycles
A tiny program sits in memory. Press Step to watch each instruction go through fetch → decode → execute. Watch the instruction-address counter (PC) move on during every fetch.
MEMORY
CPU
CPU speed is measured by the number of machine cycles, in hertz (Hz): the number of machine cycles done in 1 second. Because the numbers are huge, bigger units are used: 1 million cycles per second = 1 megahertz (MHz), and 1 billion cycles per second = 1 gigahertz (GHz).
Data comes in 5 kinds: string (text), number, audio, image and video.
While it is being processed, data (and the program) is stored digitally as binary numbers, or bit patterns, so every kind of data needs a fixed, standard representation the computer understands. When a program takes in data through an input device, the data is encoded from the form people understand into binary and kept in memory before processing. When the program shows a result, the output unit decodes the binary back into a form people understand.
So even though you see 5 different kinds of data, inside the computer they all become binary for processing, and the binary results are turned back into the kind of data you understand.
4.2.2 Input and output units หน่วยรับเข้าและหน่วยส่งออก
The standard input/output devices are the keyboard and the monitor.
When the computer runs an instruction that takes data from the user, for example:
Getting input in Python
name = input("What's your name? ")Getting input in Scratch
…the program talks to the keyboard to get the user's data, then processes it. When it runs an instruction that shows data, for example:
Showing output in Python
print('Your name is', name)Showing output in Scratch
…the program talks to the monitor to send the result to the user.
Some devices only take input or only give output, while others can do both in the same device. New input and output devices keep being invented to handle new kinds of data and what users need.
🖱️ Examples of input and output devices
1. Keyboard คีย์บอร์ด · input
Takes in data as letters, digits or special symbols. Some keyboards have extra keys, or are shaped for a particular use (Fig 4.3).
2. Mouse เมาส์ · input
Points to a position on the screen or work area, then you click, double-click, drag or scroll to choose a command, resize a window, move something, or start a program. It is used with programs that have a graphical interface. A trackpad does the same job as a mouse; it may be built into a notebook or be a separate device (Fig 4.4).
There are also devices in the same group for controlling movement in different directions, each with its own special use, such as the trackball, touch pad and joystick (Fig 4.5).
3. Microphone ไมโครโฟน · input
Takes in sound for processing, for example with speech recognition: the computer analyses what the user says and turns it into text on screen, or into a command, or works out the meaning so it can hold a conversation.
The chat in the picture:
- สวัสดี: “Hello.”
- ว่างไหม มีอะไรหรือเปล่า: “Hi! Is there anything you need?”
- หิวจัง: “I'm so hungry.”
- “If you want me to find a restaurant, just say ‘find a restaurant’.”
- ขอบใจมาก: “Thanks a lot.” · “If you're happy, I'm happy.”
4. Scanner สแกนเนอร์ · input
Scans pictures, text or objects into digital data, saved in file types such as JPG (Joint Photographic Experts Group), BMP (bitmap) or GIF (Graphics Interchange Format) (Fig 4.6).
5. Monitor จอภาพ · output
Shows the results. What a screen is like depends on the technology that makes the picture. There are many kinds, such as LCD (Liquid Crystal Display), LED (Light Emitting Diode) and VR glasses (Virtual Reality). There is also the touch screen, which is both an input and an output device: you touch it with a finger, a stylus or another device to choose commands (Fig 4.7).
6. Printer เครื่องพิมพ์ · output
Prints text or pictures onto paper, plastic, metal or cloth, and can also “print” to a document file. Some printers are both input and output devices: they can scan to a file as well as print. These are called multifunction printers. Today there are also 3D printers that build a 3D object from a model you have designed (Fig 4.8).
7. Speaker ลำโพง · output
Outputs sound that has been converted from digital data (Fig 4.9).
8. Camera กล้อง · input
Takes in pictures and records them as digital still-image or video files, to show them or to use as input for processing, for example analysing the quality of beef, detecting faces to count people going in and out, or identifying who someone is (Fig 4.10).
🎯 Input, output, or both?
The devices from this section, with their pictures from the book. Choose the right group for each one.
1. What CPU is in the smartphone or computer you use? Find out what its features are.
3. Give examples of devices that have sensors, and explain how they work.
2. What sensors does a smartphone have, and what does each one do?
4. Imagine how you could use an IoT system to help your family in daily life.
- Example: a Samsung Galaxy A-series phone uses an Exynos or Snapdragon chip with 8 cores at up to about 2.4 GHz; an iPhone uses an Apple A-series chip; a school laptop may have an Intel Core i5 with 4–6 cores at 2–4 GHz. Look in Settings → About phone or, on Windows, Settings → System → About. Features to note: number of cores, clock speed (GHz), and the company that makes it.
- Accelerometer (detects tilt and shaking; turns the screen), gyroscope (rotation, for games and AR), proximity sensor (turns the screen off near your ear), ambient light sensor (auto brightness), GPS (location for maps), fingerprint / face sensor (unlocking), magnetometer (compass), barometer (height above sea level), microphone and camera.
- Automatic doors (infrared sensor detects a person and opens the door), the smart farm in the picture (soil-moisture sensor turns on the sprinkler when the soil is dry), air-conditioners (temperature sensor), automatic hand-wash taps, car reversing sensors (ultrasonic, beeps faster as you get closer), smartwatches (heart-rate sensor).
- Example: a smart plug that turns off the rice cooker from the phone; a camera at the door that sends a LINE message when someone arrives; a moisture sensor that waters grandma's plants; a sensor that warns when the water tank is low; a light that switches on when the family comes home at night.
4.2.3 Memory and storage หน่วยความจำและจัดเก็บ
The memory and storage unit keeps the user's data and programs. It has two parts:
1) Memory หน่วยความจำ
Also called RAM (Random Access Memory). It holds data and programs while they are being processed, and keeps them only while the power is on. This property is called volatile ลบเลือนได้.
Memory has a small capacity compared with storage, but DRAM (Dynamic RAM) technology lets the data be reached very quickly.
The smallest unit of data in memory is the bit, which is either 0 or 1. A group of 8 bits is called a byte.
2) Secondary storage หน่วยจัดเก็บ
Keeps data and programs without needing power. This is called non-volatile ไม่ลบเลือน.
The user's data and programs are kept as files of many kinds: executable files, text files, document files, spreadsheet files, audio files, image files and video files. When you switch the computer on, the operating system, the programs you run and the files they need are loaded into memory for processing.
You can also keep a backup of your data in storage, to use if the original is damaged.
Storage is made of a recording medium and a device that reads and writes it. The types of storage can be divided by the technology of the medium, as follows…
| Technology | Examples | How data is kept |
|---|---|---|
| Magnetic | Hard disk drive (HDD) | Tiny magnetised areas on spinning metal platters |
| Optical | CD, DVD, Blu-ray | Pits on a disc, read by a laser |
| Flash / solid state | SSD, USB flash drive, SD card | Electric charge in memory chips; no moving parts |
Units of size: 1 byte = 8 bits · 1 KB = 1,024 bytes · 1 MB = 1,024 KB · 1 GB = 1,024 MB · 1 TB = 1,024 GB.
⚖️ Memory or storage?
Each sentence describes memory (RAM) or secondary storage. Which one?
4.3 Application software ซอฟต์แวร์ประยุกต์
From §4.1.2 you already know that application software is what the user runs to get a job done, that it is installed in storage and loaded into memory when it runs, and that it relies on the operating system to use the hardware. Ways to group it:
- Work and study: word processor, spreadsheet, presentation (Word, Excel, Google Docs/Sheets/Slides, Canva).
- Communication and the internet: web browser, email, chat (Chrome, Gmail, LINE).
- Graphics and multimedia: drawing, photo and video editing, animation.
- Specialised: accounting, maths/science calculators, school record systems.
- Games and entertainment, and programs you write yourself in Python or Scratch.
When choosing one, ask: does it run on my operating system? Does my computer have enough memory and storage for it? Is it free, paid, or a subscription?
📋 Chapter summary สรุปท้ายบท
A computer system has two main parts: hardware and software. The hardware is made of the central processing unit, which calculates and coordinates the work between the memory and the input/output unit so that instructions are carried out (each instruction is processed in sub-steps, following the machine cycle); the memory and storage unit, which keeps the computer system's data and instructions; and the input/output unit, which takes data and instructions from outside into processing and sends the results back out.
Software is a program or set of programs that controls the hardware so it can work with data the way the user wants. It is divided into system software and application software.
When you understand how hardware and software work in detail, you can judge how capable a computer is and solve simple problems yourself. You can also choose and use software appropriately and efficiently, and create work that is useful to yourself and to society.
- Describe the computer and peripheral devices you imagine could meet people's needs in the future.
- Design a program, as you imagine it, that would be useful to a lot of users.
- A laptop the size of a phone that unfolds into a 15-inch screen; it charges from sunlight, its keyboard is projected onto the desk, a camera reads hand gestures as input, and storage is in the cloud so nothing is lost if it breaks. Peripherals: AR glasses as the monitor, a ring that works as a mouse.
- Example: “Bus Buddy”. Input: GPS from drivers' phones and the student's bus stop. Processing: work out how far away the school bus is. Output: a phone notification 5 minutes before the bus arrives, and a message to parents when the student gets on. Users: every student and parent on the school bus routes.
📝 End-of-chapter exercises แบบฝึกหัดท้ายบท
What impacts does using computers have?
Good impacts: work is faster and more accurate; information and learning are easy to reach; people can communicate anywhere; it creates new jobs and new kinds of work (online shops, content creators).
Bad impacts: health problems from using screens too long (eyes, back, lack of exercise); addiction to games or social media; cyberbullying, fake news and online fraud; leaks of personal data; e-waste; some jobs being replaced by computers.
How are memory and storage different?
| Memory (RAM) | Secondary storage | |
|---|---|---|
| Holds | Data and programs being processed now | Files and programs kept for later |
| Without power | Data is lost (volatile) | Data stays (non-volatile) |
| Capacity | Small | Large |
| Speed | Very fast (DRAM) | Slower |
How do the input unit, the CPU, the memory and the output unit work together?
The input unit takes data in (e.g. the keyboard) and it is encoded to binary and stored in memory. The CPU fetches each instruction from memory, decodes it and executes it, using the data in memory, with the control unit coordinating everything and the ALU doing the calculations; results go back into registers or memory. The output unit then takes the results from memory, decodes them into a form people understand and shows them (monitor, printer, speaker). Example: type two numbers → stored in RAM → CPU adds them → the total is shown on the screen.
What are the advantages and disadvantages of using these devices?
- Wireless digital devices
- Touch screens
- LCD monitors
| Device | Advantages | Disadvantages |
|---|---|---|
| Wireless devices | No messy cables; easy to carry and use anywhere; can connect several devices | Batteries must be charged; signal can drop or have interference; can be less secure; usually more expensive |
| Touch screen | Easy and natural to use; input and output in one device; no separate mouse or keyboard needed | Fingerprints and scratches; typing long text is slow; harder to point precisely; breaks easily if dropped |
| LCD monitor | Thin and light; uses less power than old CRT screens; sharp picture | Narrower viewing angle; colours and contrast not as good as LED/OLED; can get dead pixels |
For each job, which digital devices and programs do you need, and why?
- Drawing a picture
- Keeping 10 films
- Printing a report to hand in to your teacher
- Drawing: a tablet with a stylus, or a computer with a mouse or drawing tablet (input), a monitor (output), and a graphics application such as Krita, Ibis Paint or Canva, because you need to draw precisely and see the result.
- Keeping 10 films: one HD film is about 1–4 GB, so 10 films need roughly 10–40 GB. Use secondary storage with enough space: an external hard disk, a 64 GB USB flash drive, or cloud storage, plus a video player to watch them. Storage is non-volatile, so the films stay when the power is off.
- Printing a report: a computer with a keyboard (input), a word processor such as Word or Google Docs (application software) and a printer (output), because you must type and format the text and then put it on paper.
🧠 Mini-quiz
Source: IPST (สสวท.) Basic Science and Technology textbook, Technology (Computing Science), Grade 8 (M.2), Chapter 4. Figures are from the textbook; text translated and adapted by Guru Jazzy. Book pp. 90–91 and 94–97 were missing from the scan.