Resource on UDP Programming is limited and even rare for some programming languages. For TCP Programming, I guess, there is a lot and many languages support it. For example, Java, C, C++, C#, WinSock, etc. So this article is to contribute to those limitation by taking an advantage of java.net package that supports UDP programming interface. The understanding of UDP and TCP is required.
Archive for the 'Programming' category
Performance evaluation on Java single thread and multi-thread has already been discussed in the previous post. So I will show you all the performance of .NET thread comparable to Java thread. We did the same scenario and experimental environment as my last post. The overall Java performs much better than .NET both single thread and multi-thread.
Threading could eventually improve system capacity as multi-core and multi-processor are more common in commodity computer. We can spend less than USD 1000 to get Core-i3, Core-i5 or even Core-i7. So threading technique for enabling-threading tasks could maximize the overall system performance. Be remember that not all tasks could take advantage of multi-threading. And multi-thread is not always good since its overhead and cost in coordinating data. I will discuss this scenario in the later post.
Thread implementation in Java is never easier if you do following my 3 steps strictly. However, there might be a lot of question regarding return value from a thread since
run() method returns void. So I will show you how to get return value from a thread.
Just to review how to implement java thread, the 3 steps are:
Threadclass or Implements
- In main thread, initialize thread class and then call
Assume that you understand the differences between Process and Thread. If not please refer to this article (Process vs. Thread). Concurrency can be achieved both in Process and Thread. Developing concurrency process is costly and hard to manage the process behavior since all processes have their own address space. Thread has been motivated in this sense. Thread can take a lot of advantages by supporting parallelism, low cost in creating and destroying, and easy to manage. Be remember that main thread in a process can create several child threads.