Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does assembly language interact with something like the Internet?

Tags:

assembly

So I was thinking about languages the other day, and it struck me that any program written in a compiled language that interacts with the Internet is then translated into assembly that has to interact with the Internet. I've just begun learning a bit of x86 assembly to help me understand C++ a bit better, and I'm baffled by how something so low-level could do something like access the Internet.

I'm sure the full answer to this question is much more than would fit in a SO answer, but could somebody give me maybe a basic summary?

like image 569
Maulrus Avatar asked Apr 12 '10 01:04

Maulrus


People also ask

How does assembly language interact with the computer?

Assembly language (or Assembler) is a compiled, low-level computer language. It is processor-dependent, since it basically translates the Assembler's mnemonics directly into the commands a particular CPU understands, on a one-to-one basis. These Assembler mnemonics are the instruction set for that processor.

How assembly language is used in daily life?

Today, assembly language is used primarily for direct hardware manipulation, access to specialized processor instructions, or to address critical performance issues. Typical uses are device drivers, low-level embedded systems, and real-time systems.

What uses assembly language today?

Uses of assembly language include coding device drivers, real-time systems, low-level embedded systems, boot codes, reverse engineering and more. The following are some of the reasons why learning assembly language is still important and relevant.

What is assembly language in digital electronics?

An assembly language is a low-level programming language for microprocessors and other programmable devices. It is not just a single language, but rather a group of languages. An assembly language implements a symbolic representation of the machine code needed to program a given CPU architecture.


1 Answers

User-space programs that "interact with the internet", in all modern systems, do so by issuing system calls to the underlying operating system, which supplies the API for a TCP/IP stack.

The system calls in question (such as socket, listen, accept, and so forth) are typically documented at a C level, but in each particular OS implementation they will translate to machine code, of course. But whether values go in particular registers, or locations in memory pointed to by particular registers, etc, is pretty minor and totally system-specific.

If you're wondering how the machine code (probably also compiled from C) in the kernel and device drivers "interacts with the internet" (in response to system calls), it does so both by building and maintaining in-memory data structures to track the state of various things, and by interacting with the underlying hardware (e.g. via interrupts, I/O ports, memory mapped device areas, or whatever that particular architecture uses) -- just like it interacts with (say) a video display, or a disk device.

like image 199
Alex Martelli Avatar answered Sep 21 '22 23:09

Alex Martelli