Question
How do you optimize threads?

Answers

• Avoid synchronization where possible
• Code a multi-thread for multi-processor machine.
• Synchronizing on method rather than code blocks is slightly faster.
• Polling is only acceptable when waiting for outside events and should be performed in a "side" thread. Use wait/notify instead.
• Prioritize threads. Use notify instead of notifyAll. Use synchronization sparingly.
• Keep synchronized methods out of loops if you possibly can.
• Maximize thread lifetimes and minimize thread creation/destruction cycles.
• Use Thread pools where these improve performance.
• Use Thread.sleep() instead of a for loop for measured delays.
• Use a separate timer thread to timeout socket operations.
• Use more server threads if multiple connections have high latency.   Your Comment




More Software Questions..
What is the inputsplit in map reduce software?

What is software configuration management?

What Is Java Api For Xml-based Rpc (jax-rpc)?

How can you implement fine-grained auditing?

What is IBM’s simple explanation for Big Data’s four critical features?

What is static synchronized method in JDBC API? Give an example?

What does the NULLIF function do?

What happens if a start method is not invoked and the run method is directly invoked?

Should we override finalize method

what is the difference between mysql_fetch_array and mysql_fetch_object?

How will XML affect my document links?

Why to use Style Sheets?

What are Filters in MVC?

Can you explain Application layer in OSI model?

How to define new testplan attributes?

What are the minimum system requirements to run Photoshop? Is it possible to run Photoshop over linux?

Which oracle package is used to manage the oracle lock management services?

What is Latch Up? Explain Latch Up with cross section of a CMOS Inverter. How do you avoid Latch Up?

What is marker interface?

What types of partitioning are there for BW?



Search
Can you Answer!!
  • Q How to set the current database?
  • Q explain estrogens
  • Q You want to speed up your SQL Server 2005 Service Broker queue by placing an index on it. What is the best way to do this?
  • Q What is the difference between jax-ws and jax-rpc?
  • Q A causes B or C, but not both F occurs only if B occurs D occurs if B or C occurs E occurs only if C occurs J occurs only if E or F occurs D causes G, H or both H occurs if E occurs G occurs if F occurs If J occurs which must have occurred (a) E (b) either B or C (c) both E F (d) B (e) both B and C
  • Q Describe the Floral formula of Smilacaceae ?
  • Q The names of the registered owners do not have to match the ones in the contract (A)True (B)False
  • Q How do i perform an outer join?
  • Q -------is to district as district is to------- 1)country 2)continent 3)state 4)village p)town q)village r)state s)city
  • Q When would a boarding house landlord evict a tenant with 48 hours notice? (A)If the tenant has caused, or threatened to cause, serious damage to the premises (B)The tenant is using the premises for an illegal purpose (C)If the tenant has endangered, or threatened to endanger, people or property (D)The landlord has, by written notice to the tenant, required the tenant to pay any rent in arrears within a stated period of not less than 10 days, commencing on the day the notice is given, and the tenant fails to pay the rent in arrears within the stated period (E)If the tenant has caused, or threatened to cause, serious disruption to other tenants (F)The landlord believes, having complied with section 66X, that the tenant has abandoned the room (G)Whenever the landlord wants to and no reason needs to be given
  • Q What is Barford’s reagent