.NET
  Home arrow .NET arrow Threading in Delphi for .NET
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
.NET

Threading in Delphi for .NET
By: Xavier Pacheco
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 8
    2004-08-30

    Table of Contents:
  • Threading in Delphi for .NET
  • Threading
  • The System.Threading Namespace
  • Delegates in Delphi
  • Creating Threads Using Static Methods
  • Threading Priority
  • Apartment State and Thread Pooling Class
  • Timer Classes
  • Writing Thread-safe Code .NET Style
  • Mutex and Monitor Classes
  • Locks that Distinguish Between Readers and Writers
  • Events
  • Thread Local Storage
  • User Interface Issues
  • Threading Exceptions

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Threading in Delphi for .NET


    (Page 1 of 15 )

    See these building blocks for writing applications that respond to user input during process-intensive tasks. Rick Ross of PILLAR Technology Group covers processes, threading, AppDomain, user interface issues and more. (From Delphi for .NET Developer's Guide by Xavier Pacheco, Sams, ISBN: 0-672-32443-1, 2004).

    delphi

     

    Applications that appear to be nonresponsive are seen as being poorly written. Whether it is waiting for a long-running report to finish, or printing a 100-page document, applications must respond to user input. Fortunately, writing responsive applications is not a difficult task as long as certain principles are understood.

    This chapter provides the building blocks for writing applications that respond to user input during process-intensive tasks. In addition, these same concepts are applicable to other applications such as NT Services, Application Servers, and Internet applications.

    Processes

    A process is created when an application is started. This process contains an instruction pointer that keeps track of the location currently being executed. In addition to executable code, a process contains virtual address space, memory space, and numerous CPU registers.

    The virtual address space contains a logical set of valid addresses in a process. Memory space contains the global process data—the stack where local variables are stored, the heap where memory is dynamically allocated, and the set of pages used for mapping virtual addresses to physical memory.

    Processes have three unique states: running, stopped, or blocked. Stopped processes are those that are being debugged while blocked processes are waiting for the operating system to execute them. Each process is treated as an isolated entity that is scheduled by the operating system.

    Because the operating system prevents processes from directly affecting each other, communication between two or more processes needs a predetermined protocol. Collectively, protocols used to communicate between multiple processes are called Interprocess Communications (IPC). Figure 14.1 illustrates multiple processes communicating with each other.

    delphi

    Figure 14.1  - Multiple processes communicating.

    The Windows (NT and above) operating system has several IPC mechanisms to choose from. These include

    • Named Pipes

    • Shared Memory

    • Mutexes

    • Events

    • Semaphores

    • TCP/IP Sockets

    Heavyweight is a term associated with processes because they are resource intensive. Starting and stopping a process is relatively slower than other alternatives, which are discussed in the next section. Despite the hunger for increased resources, the level of protection offered by the operating system for processes is unmatched.

    This chapter is from Delphi for .NET Developer's Guide, by Xavier Pacheco (Sams, 2004, ISBN: 0-672-32443-1). Check it out at your favorite bookstore today.

    Buy this book now.

    More .NET Articles
    More By Xavier Pacheco


     

    .NET ARTICLES

    - The Transformed XML Explorer in MFC
    - List Control and Property Grid with the MFC ...
    - Font, Shell and Masked Edit Controls for MFC
    - Color, Link and Image Editor Controls for M...
    - New Controls for MFC
    - The Windows Ribbon Framework
    - Markup Language for the Ribbon Framework
    - Visually Upgrade Your MFC Project
    - New Features for the Statusbar in MFC
    - Working with the Statusbar in MFC
    - Iron Speed Design v60 Review
    - Binary and XML Serialization
    - Using CrystalReportViewer to Display Crystal...
    - Creating Summary .Net Crystal Reports
    - More on Commands, Input and the WPF





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    Stay green...Green IT