I
I
Ivan Petrov2018-02-22 00:20:51
C++ / C#
Ivan Petrov, 2018-02-22 00:20:51

Is it worth learning C to understand how things work?

Hello.
Studied web development, then got into QA, writing selenium tests in Java. I'm going to do web development again, master php at a good level.
But I don't feel... confidence or something. All I've learned, apart from the basics, is language features, apis, etc. There is no understanding of how it works at a lower level. Memory there, addresses in memory, threads, processes, etc.
In general, is it worth learning C to understand how everything works?
I'm interested in how memory works, what threads are, I often meet mentions that some program works in several threads.
Also interesting is the interaction between computers over the network at the tcp / ip level or something like that, for example, how http servers work.
Where to begin?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
R
res2001, 2018-02-22
@bitande

Memory works simply - you can write there and read from it. It is also flat and one-dimensional. It is also virtual, but for an application programmer it doesn’t matter, the OS deals with virtuality. It is needed so that one process does not see what is being done in another process (for example, MS-DOS did not have virtual memory and any program could easily drop the OS simply by writing something unnecessary into the memory occupied by the system), so that each process has 4 GB (for x32 applications) of addressable memory, regardless of the physical presence of this memory.
In addition to the memory itself, there are also processor registers, but they are remembered only when switching to assembler, because. even C does not know how to manipulate them (it is not really necessary).
Processes and threads are OS entities designed to execute code in parallel. Threads are actually executing, and a process is a wrapper for grouping multiple threads into a single address space. Every process has at least 1 thread.
Real parallelism can be achieved only when there are >1 physical processor cores. Moreover, usually, you cannot regulate in any way when the OS will take away processor time from your thread, and when it will give it again. This can only be done by setting the thread/process priority level.
A thread differs from a process in that two different processes have different address spaces (virtual memory in action) and they need to use any interprocessor communication mechanisms (sockets, pipes, shared memory, files, ...) provided by the OS to communicate. The threads of one process work in the same address space, so they do not need to invent anything to interact, because they just can refer to the same variable. But here immediately there is a state of "race" and everything connected with it. In order to somehow streamline the simultaneous access to areas of memory or code, mutexes are needed, etc. facilities. Meanwhile, in simple cases, you can easily do without mutexes by simply structuring the code correctly and referring to the "common" memory areas in the correct order. If this is understood,
I think you can start by reading some thick book about the theory of building an OS, for example, Tanenbaum .
And C is useful, but if you don’t earn money with this, then most likely you don’t need it.
WEB, PHP, JS, CSS, etc. pythons, as a rule, are far from the hardware and OS on which it all functions.

R
Rodion, 2018-02-22
@rodion11

At the beginning of the path of learning PHP, I think that learning C is useless.
Time is a limited resource and it is more efficient to spend it on PHP itself.
The HTTP application protocol can be studied, and everything below is only for self-development.

S
Stalker_RED, 2018-02-22
@Stalker_RED

A basic understanding of HTTP and the basics of networking will do the trick anyway.
A couple of weeks* of learning C will give you an understanding of low-level processes that learning php will only take a couple of years (maybe). That being said, a couple of years of learning C will give you a skill that is very difficult to apply anywhere other than microcontrollers, drivers, and some ancient projects. Well, hacking all sorts of things, yes. That is, a useful thing, but you need to stop in time, unless, of course, you are going to study C specifically.
And yes, a couple of weeks of C and a couple of weeks of assembler are better than half a year of C.
And there are threads in high-level languages.
--------------------
* a couple of weeks of study is such a dense study, with reading good textbooks, solving examples, and picking some low-level stuff. And this is much more material than three students in vocational schools learn in a semester.

O
OnYourLips, 2018-02-22
@OnYourLips

I believe that it is necessary to learn this language, but there is no point in doing it in the first three years of your career.
The language is very simple, except for Go.
And not just to learn the language itself, but to try to write some software on pure Linux APIs and some kind of MK (at least arduino). To understand what programmers faced 30 years ago.

P
Profi_GMan, 2018-02-22
@Profi_GMan

IMHO C - no. You have to learn c++. You will still go through all the low-level moments, but then it will be possible to use C ++ with convenience in applied development, but only in system development (well, almost).
In general, if you want to learn how everything works, learn assembler. I recommend flat assembler

M
Mikhail Potanin, 2018-03-01
@potan

There is no point.
Modern systems are very layered, and C will give you an idea of ​​a narrow area of ​​one of the layers somewhere in the middle of the whole stack. In addition, the presentation of 30 years ago is not entirely out of date, but slightly outdated.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question