What are Assembly Languages (assembly language)?

Asked

Viewed 125 times

2

I was researching which languages are used to build operating systems. It appears that Windows, Mac and Linux use, to a large extent, C and C++. In the same source I found this information, I read that every kernel needs to be programmed in an assembly language (Assembly code).

But what are assembly languages? Is it the same as low-level languages? And finally, why does an operating system need to be built with this kind of language?

1 answer

4


But what are assembly languages? It’s the same as low-level languages?

Assembly is a low-level language, but it is not the lowest level. A program written in Assembly still needs to be "converted" into native language (binary) to be executed by a microprocessor. Who makes this conversion is the Assembler.

Assembly is a mnemonic-based language, which are like "nicknames" of basic operations that a microprocessor can perform. For example: accessing a location in memory, moving a value from one location to another in memory, etc.

Each microprocessor family may have its own mnemonics, as well as other specific characteristics that may influence its performance.

And finally, why does an operating system need to be built with this kind of language?

When using a high-level language, we can use classes to separate function and variable scopes, the conditional and repetitive structures, and of course, the Garbage Collector, are benefits that make it easier for us to read, but this dynamism is expensive when it comes to translating the program to the machine, since there are several microprocessors, different architectures, and a compiler needs to know the best way to transform the code we write into something that the machine will read best. Sometimes this generates a lot of additional code, not to say garbage.

Low-level languages need more code to run complex programs because they use only basic operations, this makes it difficult for a human to read, but what is written in Assembly already follows a logic practically of the level that a microprocessor will read.

Typically, the programs of an operating system are written in C and C++ which some authors consider to be mid-level languages. Writing a program directly in Assembly is more common when developing for layers closer to the Hardware, such as communication with the microprocessor or with the peripherals, or more limited or specific configurations such as for embedded software.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.