Page top

Language: JA | EN

How Software Works: From Machine Code to Software Patents

Takuya Mitani | 2018/09/18
Software is built in layers, much like layers of rock.
Applications, middleware, operating systems (OS), device drivers, and other software work together to control hardware.
Today, these layers are becoming deeper and more complex. As a result, it is harder to see how software controls the hardware at the lowest level.

When you apply for a software patent in Japan, it is important to explain how the software uses hardware resources to perform information processing.
Japan’s patent examination guidelines describe this as cooperation between software and hardware resources to create a specific information-processing device or method for a particular purpose.
This article gives a quick overview of how that cooperation works.


Stage 1: Hardware without software


Software is often used to control hardware, but many machines can work without software.
A mechanical watch moves its hands by passing the force of a spring through a set of gears. The spring and gears form a control system.

When you press the “high” switch on an electric fan, an electronic circuit makes the motor rotate faster. Because this is a simple task, the circuit can follow a basic rule: “If this switch is pressed, do this.”

In these examples, mechanical parts or electronic circuits control the machine. Software was developed to let electronic circuits perform more complex and flexible tasks.

Stage 2: Machine code


A computer that stores its program in memory is called a von Neumann computer.

A von Neumann computer repeatedly performs a simple cycle: (1) it reads an instruction from memory, (2) it carries out the instruction, and (3) it selects the next instruction. A processor, such as a CPU, carries out these instructions.

If instructions are stored in memory, the processor can follow them automatically. Change the instructions, and the processor can do a different task.

A processor contains many electronic circuits, and those circuits contain many transistors. A transistor is a switch that can be turned on or off by an electric current. By controlling many switches in different patterns, we can give instructions to a processor.
For example, one processor might be designed to treat “0000” as a command to read data from memory, “0010” as a command to add, and “0011” as a command to subtract.
If the processor receives “0000 0100,” it may read data from memory address “0100.” The exact meaning of each pattern depends on how that processor is designed.

These binary instructions are called machine code, or machine language.
When a processor receives machine code, it carries out the operations represented by the instructions. A program is a sequence of instructions stored in memory so that the processor can perform more complex tasks.

Machine code is the processor’s native language.

Early computers used punched cards to store instructions in machine code. People who worked with punched cards have said that they could sometimes guess the instructions by looking at the cards.

Machine code is the most basic form of software.

Stage 3: Assembly language


Machine code is difficult for people to read.

It also creates a compatibility problem. For example, Processor A might use “0000” for a read command, while Processor B uses “0101.” Different processors have different circuit designs, so they may use different machine code.

Assembly language was developed to make machine code easier to work with.

In assembly language, a read command might be written as “LD,” short for “Load.” A program called an assembler translates assembly language into machine code. An assembler for Processor A might translate “LD” into “0000,” while an assembler for Processor B might translate it into “0101.”

Assembly language is easier for people to read than machine code. However, it needs an extra translation step: the assembler must convert it into machine code.
The processor then follows the machine code.

Machine code and assembly language are called low-level languages.

Stage 4: High-level languages


High-level languages were developed to make programming easier than assembly language. Examples include C, C++, Java, and BASIC. There are many different high-level languages.

A compiler is a program that converts a high-level language into machine code.

One statement in a high-level language may require many machine-code instructions. For example, the C function “strcmp” compares two strings. A C compiler selects several machine-code instructions to perform that task.

A compiler does more than translate each word directly. It selects machine-code instructions that can carry out the commands written in the high-level language. Because compilers may make different choices, the performance of the same application can vary depending on the compiler.

Working out the original source code from machine code or object code is called reverse engineering.

High-level languages and compilers made programming easier. Some high-level languages, such as C, allow programmers to control hardware in detail. Others, such as BASIC, are easier to learn and use but offer less detailed control. Engineers choose a language based on the needs of the application and the programmer.

Stage 5: Operating system (OS)


Sometimes we want to run more than one program at a time. For example, we may want to edit a document while checking email.

To run multiple programs, the computer must decide which program can use the processor at each moment. For example, while a word processor is running, the computer may detect a new email and briefly run the mail program’s notification function.

An operating system (OS) manages these programs and decides when they use the processor.
The OS has a special role in the system, but it is also software, usually written in a high-level language.

As operating systems became more capable, applications began to ask the OS to handle tasks instead of sending instructions directly to hardware such as the CPU.
The OS provides functions, often through an application programming interface (API), that applications can use to work with hardware. Applications follow the OS’s rules and leave many low-level tasks to the OS.
This makes it easier for application developers to focus on building useful applications. However, developers can create applications without knowing much about what happens inside the OS. This can make it harder to see how software and hardware work together.

As a result, software came to have two main layers: the application layer, which handles specific tasks, and the operating system layer, which connects applications with the hardware and manages their work.

Operating systems such as Windows provide many functions that help developers build advanced applications. The OS is a key part of modern software technology.


Software terms


Middleware

Software that connects an application with the operating system is called middleware.
As applications became more complex, developers wanted other software to handle some of their functions. Middleware developed to meet this need.
In this structure, the application sends instructions to the middleware. The middleware communicates with the OS, and the OS controls the hardware. Middleware added another layer to the software structure, making it a three-layer system.

Object-oriented programming

There are different ways to design programs. Object-oriented programming (OOP) is one of them.
In OOP, a program is built from units called objects or classes. The program performs tasks through interactions between these units.
OOP is a useful and logical idea, although it can take time to learn. It has greatly changed how software is developed.


Cloud and Big Data

As communication networks improved, it became common to store data on remote servers or have servers perform some of the processing. Cloud computing and big data developed from this approach.
In a system where a server in the cloud works with a device in another location, it is important to consider not only the software layers but also where each process takes place.


Artificial Intelligence (AI)

Today, AI can be viewed as one type of application. One important feature of some AI systems is that they learn from large amounts of data and use that learning to change how they make decisions. This can make it difficult to understand exactly why an AI system produced a particular result.
AI is based on mathematical methods, including neural networks and principal component analysis. Its rapid development has been supported by increases in computing power and the amount of data available. Generative AI, which can create text, images, and computer code, is now also widely used.
Some experts believe that today’s main approach to AI may not remain dominant in the future. How AI will develop is still uncertain.


Quantum computers

A quantum computer is based on principles different from those of a conventional von Neumann computer.
Quantum computers may offer advantages for certain types of calculations. Some quantum-computing technologies have been demonstrated in practice, but the technology is still developing.
Its future applications remain uncertain.

Software patents


For a software patent application, you should explain how the software works with hardware resources. Since operating systems and high-level programming languages became common, the connection between a program and the machine code it runs on has become harder to see. In the future, the apparent distance between applications and hardware may grow further.

Hardware can work without software, but software needs hardware to run.
For a software-related invention, it helps to identify where the necessary hardware is located, what information the system receives, how the hardware resources process that information, and what result the system produces.
Explaining these points can help show how the software and hardware work together. It can also support a clear patent application and make it harder for competitors to avoid the patent by changing the implementation.