Professional Documents
Culture Documents
DC 9225 Exp1
DC 9225 Exp1
Experiment No 1
Roll No 9225
Code:
Client.java
Server.java
Output:
Conclusion:
Improved Performance: It can handle multiple tasks simultaneously, making the server faster.
Enhanced Responsiveness: It can respond to requests from different clients at the same time.
Better Resource Utilization:It efficiently uses system resources like CPU and memory.
Scalability: It can easily accommodate more clients without significant performance degradation.
Simplified Programming:It simplifies the coding process by allowing different tasks to run concurrently in
separate threads.
Reliability:Even if one thread encounters an issue, other threads can continue to operate, ensuring the
server remains functional.
Example while using a messaging app where you can chat with friends. In a regular setup, when you
send a message, the app might freeze until it's sent, meaning you can't do anything else. Now, think
of a multithreaded setup:
Sending Messages:Instead of freezing, a separate helper works to send your message while you keep
using the app. It handles the whole sending process without stopping you.
Receiving Messages: When a friend sends you a message, another helper jumps in to get it for you. This
way, you can get messages without waiting, even while sending your own.
Doing Multiple Things:With helpers, the app can do lots of things at once. For example, it can send
messages, get messages, and let you use the app, all without slowing down.
So, with multithreading, the app can handle many tasks at the same time, like sending and getting
messages, making it faster and smoother for you to chat with friends.