Skip to main content

Data Safety Using Informix Virtual Processors

Chuck O’Neill, Contributing author, IBM, Software Group
Chuck is a contributing author for the DB2 developer domain.
William White, Contributing Author, IBM, Software Group
William is a contributing author for the DB2 developer domain.

Summary:  Explains when and how to use user-defined or extension Virtual Processor (EVP) classes in an Informix server.

Date:  20 Dec 2001
Level:  Introductory
Activity:  299 views

© 2001 International Business Machines Corporation. All rights reserved.

Introduction

Functions created by the DataBlade are assigned to a Virtual Processor (VP) class. The class assigned to the function affects its performance characteristics and what operating system interactions the function is restricted from using. Generally, the more restrictive the VP class, the more efficient the performance of the function will be. A singularly definitive list of system calls to be avoided can not be provided, however, because it would need to change for different versions of operating systems and different types of operating systems. Additionally, the implementation of the VPs is different between UNIX and NT. On UNIX, the VPs are implemented as separate processes, while on NT each VP is an NT-thread of a common process. This difference results in some system calls being acceptable on NT which are not acceptable on UNIX. However there are also differences between the UNIX handling of shared objects and NT's handling of DLLs which make these distinctions complex. Additionally, it is assumed that most companies will want their DataBlade code to be portable between UNIX and NT. In the interest of simplicity, a single list is presented with NT specific calls listed in brackets. NT specific comments are summarized at the end of the paper.

On UNIX, to check if an undesired system call has been included it is suggested you use nm and ldd. nm will list the unresolved references used in a shared object. ldd will list the dynamic dependencies from a shared object. Given the .bld shared object produced for a DataBlade module, you should check the unresolved references for it, and recursively for all its dependencies, to see if they include a system call which violates the VP desired.

On NT, the DUMPBIN command with the /IMPORTS option will give the equivalent information.

There are three VP classes used for DataBlade functions:

  • CPU VP
  • User-Defined VP
  • No-Yield User-Defined VP

CPU VP

All routines which do not run explicitly in a user-defined VP are run in the CPU class VP by default. This is the most restrictive VP class. The following types system calls must not be used in a CPU VP.

  • Calls which perform blocking IO (open, read, accept, bind, etc.)
  • Calls which manipulate signals to processes (signal, alarm, beep, etc.)
  • Calls which modify the systems security (setuid, seteuid, setruid, setgid, setegid, setrgid, etc.)
  • Calls which allocate or free memory (malloc, calloc, realloc, free,etc.)
  • Calls which initiate OS provided threads (pthread_create, thr_create, etc.)
  • Calls which initiate or halt system processes (fork, exec, exit, system, popen, etc.)
  • Calls which change the current working directory
  • Calls which change the process' global state (gethostent, gethostbyaddr, gethostbyname, sethostent, endhostent, etc.)
  • Calls which modify the process' data segment size (brk, sbrk, etc.)
  • Calls which modify shared memory segments (shmat, etc.)
  • Calls which modify the dynamic linker's run-time environment (dlopen, dlsym, dlerror, dlclose, etc.) [LoadLibrary, etc.]

Additionally the code must not update any global and/or static variables.

The execution of a server-side DataBlade function should not take excessive amount of CPU time (> 0.1 second) without calling mi_yield().


User-Defined VP

If the DataBlade module uses a prefix registered with Informix, then the name of a User-Defined VP is required to begin with the DataBlade's prefix.

All of the restrictions of the CPU VP apply except for those involving blocking IO. This VP is most often used, if it is not practical to rewrite the file system activity using the LIBDMI interface.


No-Yield User-Defined VP

All of the restrictions of the User-Defined VP apply except for the use of global and/or static variables. This VP is most often used if the supporting code is not designed to handle concurrency issues.

NT specific comments:

DataBlade must use either the MT or static versions of the system libraries.

While NT developers should not call malloc and free directly, their occurrence in the binary from the use of MT dlls is considered safe.

The following actions are allowed on NT providing that they do not interfere with the shared memory model which IDS/UD uses:

DataBlades may create additional threads or processes

DataBlade may use shared memory for interprocess communication.

UNIX specific comments:

On Solaris, /usr/ucb/ld is a shell script which ends up calling /usr/ccs/bin/ld with modifications to make it "compatible" with the BSD package. These modifications force the BSD libraries and routines to be included BEFORE the base OS libraries and routines. Since the BSD version of libc includes sockets, unlike the ccs version, the following libs are added:

 
-lucb -lresolv -lsocket -lnsl -lelf 

For this reason, all DataBlades should be linked using /usr/ccs/bin/ld and NOT /usr/ucb/ld


About the authors

Chuck is a contributing author for the DB2 developer domain.

William is a contributing author for the DB2 developer domain.

Comments (Undergoing maintenance)



Trademarks  |  My developerWorks terms and conditions

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Information Management
ArticleID=87423
ArticleTitle=Data Safety Using Informix Virtual Processors
publish-date=12202001
author1-email=noemail@us.ibm.com
author1-email-cc=
author2-email=
author2-email-cc=

My developerWorks community

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Special offers