ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [GO beginner_Chapter.1] What is GOLANG?
    배움/GOLANG 2023. 12. 7. 21:57
    반응형

    1. What is GOLANG?

    When I first heard about GOLANG, I was puzzled. It's a fundamental concept that wasn't even introduced in the lectures. GOLANG is a programming language, just like C, Java, Python. Think of GOLANG = GO Language = Go Language to make it simple.

     

     

     

    2. Who Created GOLANG? Concise Syntax and Fast Compilation

    GOLANG was developed by Robert Griesemer, Rob Pike, Ken Thompson at Google as a programming language to replace C and Java. GOLANG is 'composed of only 25 concise syntaxes', compared to 27 in C and 84 in C++, making it less intimidating for beginners.

     

     

    Also, a key concept of GOLANG is that its 'Compiler is fast'. What is a compiler? Simply put, a compiler is something that converts a program written in computer language into a form that the computer can understand and execute. I thought the computer would read the programming language directly, but it turns out it needs to be translated into a computer-readable form. However, the compilation process for existing programming languages was too slow. Therefore, GOLANG was developed for its simple language syntax and fast processing speed.

     

     

    3. Where is GOLANG Used?

    GOLANG is especially used in very large networks because of its fast speed, memory optimization, and concurrent processing capabilities. Think about Netflix, cloud services, Uber, blockchain being shared worldwide. GOLANG helps computers to quickly share and cooperate with each other's information. Just like when we work on a big project, each department needs to communicate and cooperate well for the work to proceed quickly and smoothly.

     


     

    Reference Material

    Java's threads and Golang's goroutines are the basic units used in running programs in each language. They help the program to process multiple tasks simultaneously. The following examples make it easier to understand.

     

    Java's Threads and Efficiency Java Threads: Java's threads work like waiters in a restaurant, each responsible for different tables. Each waiter (thread) manages their table, preventing confusion between tables. However, the downside is that many waiters are needed, meaning a lot of resources (waiters) and coordination (management) are required. Since each waiter focuses only on their table, it's hard for them to help at other tables once they're done. This can lead to inefficient use of resources.

     

    Golang's Goroutines and Efficiency Goroutines: On the other hand, a goroutine in Golang is like a waiter handling small tasks at several tables quickly and alternately. This waiter moves swiftly between tables, efficiently handling various tasks. The advantage is that one waiter (goroutine) can handle diverse requests from multiple tables simultaneously. Thus, the number of waiters needed to handle the same amount of work is reduced, and each waiter's time is used more efficiently. Goroutines use a small memory space and can switch between waiters quickly, making them 'useful for network services or systems that require complex concurrent processing'.

     

    Conclusion Efficiency Comparison: Java's threads are effective in handling independent tasks but require many resources. In contrast, Golang's goroutines can efficiently switch and handle multiple tasks within one thread, using fewer resources and simplifying management. Goroutines are particularly efficient in situations where there are many small tasks that need to be switched quickly. This shows that the goroutine method can handle the same tasks with fewer resources, more quickly, and more efficiently.

    반응형
Designed by Tistory.