I am a student of computer science. In my 5th semester i have to learn assembly language. After 6/7 weeks in my class i just came to know that this assembly language learning will teach me about knowledge about microprocessor. But i want to know that is there any advantage learning assembly in 2018???
-
2Because it's fun. – Ped7g Mar 31 '18 at 21:11
2 Answers
Assembly helps you become familiar with fundamental principles in computing. It's essentially working from scratch, doing calculation that we take for granted nowadays when coding in high-level languages.
It could be compared to studying history. Although it may seem ancient in computer years, what you are studying is very much alive and being used in many industries. Through this study, we are able to see where this process was started and how it got to this point, where we mostly use use newer languages without worrying about machine code and its complexity.
It's not necessary to learn assembly it if you aren't directly working with assembly languages. However, if you want to do low-level programming, reverse-engineering or understand what is really happening when you write code, studying assembly would be useful.

- 432
- 6
- 17
-
ASM is still how computers work now. It's more like studying physics than history; the underlying details. (re: history: I'd recommend against learning 16-bit x86 with DOS system calls, though (OP used the emu8086 tag). That's just making life difficult for yourself compared to 32-bit or 64-bit code with a flat memory model, using the same system calls or libraries that real programs on your desktop actually use. See some of the early links in [SO's x86 tag wiki](https://stackoverflow.com/tags/x86/info) for suggestions on learning. Or use a MIPS simulator or whatever and get to x86 later!) – Peter Cordes Mar 31 '18 at 22:20
-
Not only will the knowledge of it be useful, there are many jobs that will have you apply that knowledge and program in assembly or utilize your reading and comprehension for reverse engineering. I wish all schools taught assembly and C more. When I recommend a school to someone for computer science one of my major things I look at is if they teach assembly or C. – Paul T Apr 02 '18 at 13:07
There are two main reasons why someone would learn an assembly language these days:
- To develop highly performant code - generally for a microcontroller, though C is becoming fairly prevalent for these, as it is "efficient enough", from what I understand.
- To gain a better understanding of how the high-level code you usually write actually works. This allows you to understand what sort of activities are more computationally expensive, memory inefficient, or similar, meaning you can work to write more efficient code at the high level.
Disclaimer: I'm currently studying a CS-related course, I learned MIPS-assembly last year, and these are the reasons they gave. It's entirely possible that some industries have more niche reasons to know assembly.

- 212
- 1
- 10
-
1Yup, performance analysis of compiler-generated binaries is one reason for knowing asm. It lets you answer questions [like this one](https://stackoverflow.com/questions/49189685/adding-a-redundant-assignment-speeds-up-code-when-compiled-without-optimization). And understand what compiling without optimization means and implies, exactly. – Peter Cordes Mar 31 '18 at 20:15
-
Or it's useful for actually *being* a compiler developer, or just filing missed-optimization bugs in gcc/clang when you see them generate code that's worse than what it could have made :P Related: https://stackoverflow.com/questions/40354978/why-is-this-c-code-faster-than-my-hand-written-assembly-for-testing-the-collat/40355466#40355466 for more about tweaking C source to compile more efficiently, vs. what you can do with optimizations you can't hand-hold a compiler into making. (So you might do that if one single loop in your whole program was *very* important. Or for a libc `strlen`... – Peter Cordes Mar 31 '18 at 20:17