affiliate_link

Saturday, February 27, 2016

Mutithreading FAQs with examples

Deadlock

To further illustrate how a deadlock might occur, imagine the following sequence of events:
  • Thread 1 acquires lock A.
  • Thread 2 acquires lock B.
  • Thread 1 attempts to acquire lock B, but it is already held by Thread 2 and thus Thread 1 blocks until B is released.
  • Thread 2 attempts to acquire lock A, but it is held by Thread 1 and thus Thread 2 blocks until A is released.
At this point, both threads are blocked and will never wake up

Race Conditions

race condition occurs when two threads access a shared variable at the same time. The first thread reads the variable, and the second thread reads the same value from the variable. Then the first thread and second thread perform their operations on the value, and they race to see which thread can write the value last to the shared variable. The value of the thread that writes its value last is preserved, because the thread is writing over the value that the previous thread wrote.

// Thread 1
   Total = Total + val1
// Thread 2
   Total = Total - val2
Reference: https://support.microsoft.com/en-us/kb/317723

Sunday, May 17, 2015

Ultimate WordPress Resource

Best WordPress Themes

1. Affiliate WordPress Themes - The Best WordPress Themes for setting up an affiliates Website
2. Gaming WordPress Themes - Best Theme for setting up any kind of Gaming Website
3. Sports WordPress Themes - Sports Related Website on WordPress Platform
4. Magazine WordPress Themes - Blog or Magazine Themes
5. Real Estate WordPress Themes 
6. Best Car Rental WordPress Themes

Best WordPress Plugins

2. Best Form Builder Plugins
3. Best SEO Plugins For WordPress
4. Backup Plugins For WordPress

Friday, May 8, 2015

Crystal Reports Issues on VS2013 Windows 8.1 64-bit


Issue #1

If you are facing problems running Crystal Reports on Windows 8 64-bit

Resolution

make sure you have installed the latest version of Install Executable from the following url

http://scn.sap.com/docs/DOC-7824

At the time of this writing Support Pack 13 (v.13.0.13.1597) is the latest version



Issue # 2

Unsupported Operation. A document processed by the JRC engine cannot be opened in the C++ stack windows app

Resolution
Check project configuration and platform in the Configuration Manager of the project Context. Report (.rpt files) should exist in the respective Debug or Release folder of the project 





Friday, March 6, 2015

What is laaS (Infrastructure as a service)?

IaaS is one of the three fundamental service models of cloud computing alongside Platform as a Service (PaaS) and Software as a Service (SaaS). As with all cloud computing services it provides access to computing resource in a virtualised environment, “the Cloud”, across a public connection, usually the internet. In the case of IaaS the computing resource provided is specifically that of virtualised hardware, in other words, computing infrastructure. The definition includes such offerings as virtual server space, network connections, bandwidth, IP addresses and load balancers. Physically, the pool of hardware resource is pulled from a multitude of servers and networks usually distributed across numerous data centers, all of which the cloud provider is responsible for maintaining. The client, on the other hand, is given access to the virtualised components in order to build their own IT platforms.
In common with the other two forms of cloud hosting, IaaS can be utilised by enterprise customers to create cost effective and easily scalable IT solutions where the complexities and expenses of managing the underlying hardware are outsourced to the cloud provider. If the scale of a business customer’s operations fluctuate, or they are looking to expand, they can tap into the cloud resource as and when they need it rather than purchase, install and integrate hardware themselves.
The following are salient examples of how IaaS can be utilised by enterprise:
  • Enterprise infrastructure; by internal business networks, such as private clouds and virtual local area networks, which utilise pooled server and networking resources and in which a business can store their data and run the applications they need to operate day-to-day. Expanding businesses can scale their infrastructure in accordance with their growth whilst private clouds (accessible only by the business itself) can protect the storage and transfer of the sensitive data that some businesses are required to handle.
  • Cloud hosting; the hosting of websites on virtual servers which are founded upon pooled resources from underlying physical servers. A website hosted in the cloud, for example, can benefit from the redundancy provided by a vast network of physical servers and on demand scalability to deal with unexpected demands placed on the website.
  • Virtual Data Centers (VDC);  a virtualised network of interconnected virtual servers which can be used to offer enhanced cloud hosting capabilities, enterprise IT infrastructure or to integrate all of these operations within either a private or public cloud implementation.
 A typical Infrastructure as a Service offering can deliver the following features and benefits:
  • Scalability; resource is available as and when the client needs it and, therefore, there are no delays in expanding capacity or the wastage of unused capacity
  • No investment in hardware; the underlying physical hardware that supports an IaaS service is set up and maintained by the cloud provider, saving the time and cost of doing so on the client side
  • Utility style costing; the service can be accessed on demand and the client only pays for the resource that they actually use
  • Location independence; the service can usually be accessed from any location as long as there is an internet connection and the security protocol of the cloud allows it
  • Physical security of data centre locations; services available through a public cloud, or private clouds hosted externally with the cloud provider, benefit from the physical security afforded to the servers which are hosted within a data centre
  • No single point of failure; if one server or network switch, for example, were to fail, the broader service would be unaffected due to the remaining multitude of hardware resources and redundancy configurations.  For many services if one entire data center were to go offline, nevermind one server, the IaaS service could still run successfully.

Thursday, May 29, 2014

What is Scrum (Software Development) vs Agile Software Development?

Scrum

Scrum is an iterative and incremental agile software development framework for managing software projects and product or application development. It defines

"a flexible and holistic product development strategy where a development team works as a unit to reach a common goal"

It challenges assumptions of the traditional sequential approach to product development

Reference: http://en.wikipedia.org/wiki/Scrum_(software_development)

Agile Software Development

Agile software development is a group of software development methods based on iterative and incremental development in which requirements and solutions evolve through collaboration between self organizing and cross functional teams. It promotes adaptive planning, evolutionary development and delivery encourages rapid and flexible response to change

Reference: http://en.wikipedia.org/wiki/Agile_software_development

Wednesday, May 21, 2014

Multithreading Multiprocessor vs Single-Processor Computers

Multiprocessor Computers

Multithreading provides greater throughput. Ten processors can do ten times the work of one, but only if the work is divided so that all ten can be working at once; threads provide an easy way to divide the work and exploit the extra processing power. If you use multithreading on a multiprocessor computer:
  • The number of threads that can execute concurrently is limited by the number of processors.
  • A background thread executes only when the number of foreground threads executing is smaller than the number of processors.
  • When you call the Thread.Start method on a thread, that thread might or might not start executing immediately, depending on the number of processors and the number of threads currently waiting to execute.
  • Race conditions can occur not only because threads are preempted unexpectedly, but because two threads executing on different processors might be racing to reach the same code block.

Single-Processor Computers 

Multithreading provides greater responsiveness to the computer user, and uses idle time for background tasks. If you use multithreading on a single-processor computer:
  • Only one thread runs at any instant.
  • A background thread executes only when the main user thread is idle. A foreground thread that executes constantly starves background threads of processor time.
  • When you call the Thread.Start method on a thread, that thread does not start executing until the current thread yields or is preempted by the operating system.
  • Race conditions typically occur because the programmer did not anticipate the fact that a thread can be preempted at an awkward moment, sometimes allowing another thread to reach a code block first.

Deadlocks vs Race Conditions

Deadlocks
 
A deadlock occurs when each of two threads tries to lock a resource the other has already locked. Neither thread can make any further progress.

Many methods of the managed threading classes provide time-outs to help you detect deadlocks. For example, the following code attempts to acquire a lock on the current instance. If the lock is not obtained in 300 milliseconds, Monitor.TryEnter returns false

if (Monitor.TryEnter(lockObject, 300)) {
    try {
        // Place code protected by the Monitor here.
    }
    finally {
        Monitor.Exit(this);
    }
}
else {
    // Code to execute if the attempt times out.
}
 
Race Conditions
 
A race condition is a bug that occurs when the outcome of a program depends on which of two or more threads reaches a particular block of code first. Running the program many times produces different results, and the result of any given run cannot be predicted.

A simple example of a race condition is incrementing a field. Suppose a class has a private static field (Shared in Visual Basic) that is incremented every time an instance of the class is created, using code such as objCt++; (C#) or objCt += 1 (Visual Basic). This operation requires loading the value from objCt into a register, incrementing the value, and storing it in objCt.

In a multithreaded application, a thread that has loaded and incremented the value might be preempted by another thread which performs all three steps; when the first thread resumes execution and stores its value, it overwrites objCt without taking into account the fact that the value has changed in the interim.

Reference: http://msdn.microsoft.com/en-us/library/1c9txz50%28v=vs.110%29.aspx