Logo

Navigation
  • Home
  • Services
    • ERP Solutions
    • Implementation Solutions
    • Support and Maintenance Solutions
    • Custom Solutions
    • Upgrade Solutions
    • Training and Mentoring
    • Web Solutions
    • Production Support
    • Architecture Designing
    • Independent Validation and Testing Services
    • Infrastructure Management
  • Expertise
    • Microsoft Development Expertise
    • Mobile Development
    • SQL Server Database and BI
    • SAP BI, SAP Hana, SAP BO
    • Oracle and BI
    • Oracle RAC
  • Technical Training
    • Learn Data Management
      • Business Intelligence
      • Data Mining
      • Data Modeling
      • Data Warehousing
      • Disaster Recovery
    • Learn Concepts
      • Application Development
      • Client Server
      • Cloud Computing Tutorials
      • Cluster Computing
      • CRM Tutorial
      • EDI Tutorials
      • ERP Tutorials
      • NLP
      • OOPS
      • Concepts
      • SOA Tutorial
      • Supply Chain
      • Technology Trends
      • UML
      • Virtualization
      • Web 2.0
    • Learn Java
      • JavaScript Tutorial
      • JSP Tutorials
      • J2EE
    • Learn Microsoft
      • MSAS
      • ASP.NET
      • ASP.NET 2.0
      • C Sharp
      • MS Project Training
      • Silverlight
      • SQL Server 2005
      • VB.NET 2005
    • Learn Networking
      • Networking
      • Wireless
    • Learn Oracle
      • Oracle 10g
      • PL/SQL
      • Oracle 11g Tutorials
      • Oracle 9i
      • Oracle Apps
    • Learn Programming
      • Ajax Tutorial
      • C Language
      • C++ Tutorials
      • CSS Tutorial
      • CSS3 Tutorial
      • JavaScript Tutorial
      • jQuery Tutorial
      • MainFrame
      • PHP Tutorial
      • VBScript Tutorial
      • XML Tutorial
    • Learn Software Testing
      • Software Testing Types
      • SQA
      • Testing
  • Career Training
    • Career Improvement
      • Career Articles
      • Certification Articles
      • Conflict Management
      • Core Skills
      • Decision Making
      • Entrepreneurship
      • Goal Setting
      • Life Skills
      • Performance Development
      • Personal Excellence
      • Personality Development
      • Problem Solving
      • Relationship Management
      • Self Confidence
      • Self Supervision
      • Social Networking
      • Strategic Planning
      • Time Management
    • Education Help
      • Career Tracks
      • Essay Writing
      • Internship Tips
      • Online Education
      • Scholarships
      • Student Loans
    • Managerial Skills
      • Business Communication
      • Business Networking
      • Facilitator Skills
      • Managing Change
      • Marketing Management
      • Meeting Management
      • Process Management
      • Project Management
      • Project Management Life Cycle
      • Project Management Process
      • Project Risk Management
      • Relationship Management
      • Task Management
      • Team Building
      • Virtual Team Management
    • Essential Life Skills
      • Anger Management
      • Anxiety Management
      • Attitude Development
      • Coaching and Mentoring
      • Emotional Intelligence
      • Stress Management
      • Positive Thinking
    • Communication Skills
      • Conversation Skills
      • Cross Culture Competence
      • English Vocabulary
      • Listening Skills
      • Public Speaking Skills
      • Questioning Skills
    • Soft Skills
      • Assertive Skills
      • Influence Skills
      • Leadership Skills
      • Memory Skills
      • People Skills
      • Presentation Skills
    • Finding a Job
      • Etiquette Tips
      • Group Discussions
      • HR Interviews
      • Interview Notes
      • Job Search Tips
      • Resume Tips
      • Sample Resumes
 

TSR in C – An Introduction

By Ramesh B | on July 11, 2006 |
C Language

What does TSR stands for?

TSR stands for Terminate- and Stay-Resident programs

What’s Special about TSR!

As the name says Terminate-and-Stay-Resident TSR are programs which get loaded in memory and remain or stay there (resident) in memory permanently. They will be removed only when the computer is rebooted or if the TSR is explicitly removed from memory. Until then they will stay (resident) in memory active

Working Technology of TSR

Nothing happens because of TSR occupying place in memory. In other words when TSR is not running it does not affect the running of other DOS programs. It stays in memory in idle state. Only thing it does is it occupies memory space and the occupied TSR memory space cannot be occupied by other programs. So users have to take care of this aspect when writing TSR’s. Since when number of TSR’s is written then each occupies memory space and these spaces cannot be occupied by other programs. So design the TSR’s taking this aspect into consideration.

Now let us see the working technology of TSR.

We know that TSR gets loaded into memory and stays there. When number of TSR’s is loaded the TSR gets loaded in the structure of STACK. This is nothing but the TSR gets piled up one above the other with the latest TSR loaded on the top. So one may get amazed how to activate a particular TSR if there are number of TSR available in stack.

This is done by activating keys which gets associated with TSR. When the particular key associated with TSR gets activated then the corresponding TSR is called which means the program that is associated with that TSR from memory (which is already present in memory) gets activated. Now the next question that pops into one’s mind is how the keys and TSR gets associated. In other words when a key is presses how is the TSR corresponding to it gets activated.

             

This is done if we understand the simple technology of IVT named as Interrupt Vector Table. Let us see in detail how it works.

Normally Interrupt Vector Table has the address of Interrupt Service Routine which is nothing but the routine that should be handled in case of an interrupt. So in a normal process when an interrupt occurs the interrupt number is multiplied by four and this result is searched in Interrupt Vector Table and the contents of this result in Interrupt Vector Table gives the address of interrupt service routine. After getting the routine’s address the control passes to the routine and the action as specified in routine gets executed. This is normal process that takes place.

But now interesting fact to know is how TSR gets activated here on event of pressing a key that is in case of an interrupt. This is done by TSR as follows. When a normal interrupt occur the address of Interrupt Service Routine is replaced with address from TSR routines. So after this the process continues as before. That is the routine checks to find if the interrupt has any association with TSR keys if it is then the corresponding routine gets executed. Otherwise the control returns to Interrupt service Routine which is the original process.

Suppose if we have number of TSR loaded as stack the process is same except that check is made to find if the interrupt has association with TSR key sequence that is in top of stack in other words with the TSR that was loaded the latest. If it is it executes the process associated with that TSR otherwise control passes to the next TSR in stack to perform the check whether it has association with the interrupt and this process goes on. After all TSR is checked and processed the control gets back to the original Interrupt Service Routine and the process continues as usual.

Relationship between Virus and TSR

One more interesting fact to know about is about the similarities between virus and TSR. All viruses are TSR’s but none of the TSR’s is virus. This fact is because TSR are Terminate-Stay-Resident programs which will get loaded in memory and stay there permanently until explicitly removed. Similarly viruses also get loaded and stay in memory. But the main difference is virus gets into memory without users knowledge but TSR gets into memory in the control of user since it is written by users only.

So having known about TSR and its working terminology one may get an idea that we can remove virus by changing the contents of Interrupt vector table into original state. We can do that but the greatest risk associated here is while changing the contents of Interrupt vector table there is a possibility that some Terminate Stay Resident Programs which are already written and which exists in memory previously may have associated interrupts placed in Interrupt Vector Table.

While changing the Interrupt Vector Table for virus cleaning if we write on any of these TSR associated interrupt by mistake then the interrupts associated with existing TSR gets damaged . As a result of this activity the TSR will exist but without any use that is in other words the associated interrupt will not be called. These effects cause the TSR to stay in memory without having any effect.  So users have to take care while doing this process and it is better to avoid this activity.

« « Concept of Pixel in C Graphics
A Java TOC2 Class Which Can Contact Aim » »

Author Description

Avatar

Free Training

RSSSubscribe 394 Followers
  • Popular
  • Recent
  • C Programming – Decision Making – Branching

    April 4, 2006 - 0 Comment
  • C Language – The Preprocessor

    May 31, 2006 - 0 Comment
  • C Programming – Decision Making – Looping

    April 4, 2006 - 0 Comment
  • Call by Value and Call by Reference

    July 6, 2006 - 0 Comment
  • C Programming – Arrays

    April 13, 2006 - 0 Comment
  • Concept of Pixel in C Graphics

    July 11, 2006 - 0 Comment
  • C Programming – Handling of Character String

    April 17, 2006 - 0 Comment
  • C Programming – Data Types : Part 2

    August 21, 2011 - 0 Comment
  • C Programming – An Overview

    March 2, 2006 - 0 Comment
  • C Programming – Functions (Part-II)

    May 22, 2006 - 0 Comment
  • C Programming – Data Types : Part 2

    August 21, 2011 - 0 Comment
  • C Circular Linked Lists

    June 26, 2011 - 0 Comment
  • C Doubly Linked Lists

    June 26, 2011 - 0 Comment
  • Concept of Pixel in C Graphics

    July 11, 2006 - 0 Comment
  • Call by Value and Call by Reference

    July 6, 2006 - 0 Comment
  • C Language – The Preprocessor

    May 31, 2006 - 0 Comment
  • C Programming – File management in C

    May 31, 2006 - 0 Comment
  • C Programming – Linked Lists

    May 29, 2006 - 0 Comment
  • C Programming – Dynamic Memory allocation

    May 29, 2006 - 0 Comment
  • C Programming – Pointers

    May 25, 2006 - 0 Comment

Exforsys e-Newsletter

ebook
 

Related Articles

  • C Programming – Data Types : Part 2
  • C Circular Linked Lists
  • C Doubly Linked Lists
  • Concept of Pixel in C Graphics
  • Call by Value and Call by Reference

Latest Articles

  • Project Management Techniques
  • Product Development Best Practices
  • Importance of Quality Data Management
  • How to Maximize Quality Assurance
  • Utilizing Effective Quality Assurance Strategies
  • Sitemap
  • Privacy Policy
  • DMCA
  • Trademark Information
  • Contact Us
© 2023. All Rights Reserved.IT Training and Consulting
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.AcceptReject Read More
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT