Solaris who is using directory
The developer controls a process by writing an operation code and optional operand to the first 8 bytes of the control file or 16 bytes if it's an LP64 kernel. The control file write path is also through the vnode layer and ultimately enters the procfs prwritectl function. The implementation allows multiple control messages operations and operands to be sent to the control file in a single write. Table 2. We include them here to provide context for the subsequent descriptions of control functions, as well as to illustrate the power of procfs.
Procfs Control Messages Control Message. Sets process or LWP runnable. The long arg can specify clearing of signals or faults, setting single step mode, etc. Various fields in the process, user uarea , LWP, and kernel thread structures facilitate process management and control with procfs. Establishing process control involves setting flags and bit mask fields to track events that cause a process or thread to enter or exit the kernel.
These events are signals, system calls, and fault conditions. The entry and exit points for these events are well defined and thus provide a natural inflection point for control mechanisms.
A stop on a system call entry occurs when the kernel is first entered the system call trap , before the argument list for the system call is read from the process. System call exit stops have the process stop after the return value from the system call has been saved. Fault stops also occur when the kernel is first entered; fault conditions generate traps, which force the code into a kernel trap handler.
Signal stops are tested for at all the points where a signal is detected, on a return from a system call or trap, and on a wakeup see Section 2. Address space watch directives allow a controlling process to specify a virtual address, range in bytes , and access type for example, read or write access for a segment of a process's virtual address space. In some cases, the extraction of process information and process control requires the controlling process to have the target process perform specific instructions on its behalf.
For example, the pfiles 1 command, which lists the open files of a process and provides information about each opened file, requires the target process to issue a stat 2 system call on each of its open file descriptors. Since the typical process running on a Solaris system spends a fair amount of its time blocking on a system call not related to procfs , getting control of the target process to perform a specific task requires grabbing the process while it is blocked and preserving the system call state so that it can be restored and resume properly when the controlling process has had its request satisfied.
Procfs implements an agent LWP for this purpose. The agent LWP controls the execution of the target process as required to satisfy the controlling process's request for example, execute system calls within the target process. A test on this pointer in various areas of the kernel determines whether an agent LWP exists for the process.
The finer details of the process control directives, their use, and the subtleties of the behavior they create are well documented in the proc 4 man page. Among its many benefits, procfs enables us to track and extract information about process resource utilization and state changesthe subject of the next section. The kernel supports the gathering of relatively fine-grained resource-utilization information in the process framework.
Resource usage data is a collection of counters embedded in a structure called lrusage. Thus, the data reflected at the process level represents the sum total for all the LWPs in the process. Number of input blocks. Number of output blocks. As above, incremented in bio. Number of signals received. Incremented in the kernel psig code, where the LWP is set up to run the signal handler. Number of voluntary context switches. Number of involuntary context switches. Incremented when an LWP is context-switched because it uses up its allotted time quantum or is preempted by a higher-priority kthread.
The resource utilization counters do not require microstate accounting enabling for the process or LWP. Within the process, the operating system maintains a high-resolution timestamp that marks process start and terminate times. Start and termination times are also maintained in the LWP when microstate accounting is enabled. The value is not related to current time and thus is only useful when used in conjunction with a subsequent call to gethrtime.
In that case, the difference in the return values from the first call and the second call yields a high-resolution measurement of elapsed time in nanoseconds. This is precisely how it is used when microstate accounting is enabled.
Processor-specific conversion routines convert the register value to nanoseconds, based on processor clock speeds. The kernel also supports the notion of microstate accounting, that is, the timing of low-level processing states.
Microstate accounting is the fine-grained retrieval of time values taken during one of several possible state changes that can occur during the lifetime of a typical LWP. The timestamps are maintained in arrays at the LWP and process level.
As was the case with resource utilization, the LWP microstates are recorded during execution, and the array in the process is updated when the LWP terminates. The microstate accounting and resource usage structures for the process and LWP are shown below. Microstate accounting is enabled by default in Solaris 10 it was disabled by default in previous Solaris releases. The actual microstates are shown below. The above initialization steps show two additional microstate-related fields not yet discussed.
You will see where this comes into play in a moment. Microstate Changes New State. Tracking LWP microstates in Solaris 10 is a snap with prstat 1. Use the -mL flags, which provide microstate columns for each LWP thread in the process. The prstat 1 output shows the percentage of time spent in a given microstate over the last sampling period default is 5 seconds , beginning with the USR column, up to and including the LAT column.
See the prstat 1 man page. Total: 71 processes, lwps, load averages: 1. Previous page. By signing in, you agree to our Terms of Use and Privacy Policy. Already have an account? Sign in. By signing up, you agree to our Terms of Use and Privacy Policy. Enter the email address associated with your account. We'll send a magic link to your inbox. Email Address. All Sign in options. Enter a Email Address. Choose your interests Get the latest news, expert insights and market research, sent straight to your inbox.
Newsletter Topics Select minimum 1 topic. Operating Systems. Tags: Solaris. Anonymous March 1, 0 Comments. Hi experts, Plz clear my doubts What command to list only the directories? To create a new directory, type the mkdir command and follow it with the name of the new directory. However, you can often use a shorter name that defines the file or directory relative to the current working directory.
When you are in a parent directory, you can move to a subdirectory by using only the directory name and not the full path name.
In the previous example, the command cd veggies uses the relative path name of the directory veggies. Create several different subdirectories, and then move around within this directory structure.
Use both full path names and relative path names, and confirm your location with the pwd command. You rename a directory by moving it to a different name. Use the mv command to rename directories. In this example, the directory carrots is moved from veggies to veggies2 with the mv command.
Use the cp -r command to copy directories and the files they contain:. The command in the previous example copies all files and subdirectories within the directory veggies to a new directory veggies3.
This is a recursive copy, as designated by the -r option. If you attempt to copy a directory without using this option, the system displays an error message. To remove an empty directory, use the rmdir command as follows:. If the directory still contains files or subdirectories, the rmdir command does not remove the directory. To remove a directory and all its contents, including any subdirectories and files, use the rm command with the recursive option, -r.
Directories that are removed with the rmdir command cannot be recovered, nor can directories and their contents removed with the rm -r command. Use the diff command to view differences between similar files. The following command scans each line in leftfile and rightfile to check for differences. When the diff utility finds a line or lines that differ, diff determines if the difference is the result of an addition, a deletion, or a change to the line, and how many lines are affected. If the difference is the result of an addition, diff displays a line with the following format.
In the previous example, l is a line number in leftfile and r is a line number in rightfile. If the difference is the result of a deletion, diff uses a d in place of a. If the difference is the result of a change on the line, diff uses a c. The relevant text from both files immediately follow the line number information.
For more information on the diff 1 command, refer to the man Pages 1 : User Commands. To compare three different versions of a file, use the diff3 command. If you are comparing large files, use bdiff instead of diff.
Use the diff command syntax with bdiff. Use bdiff instead of diff for files longer than lines. The find command searches for files that meet conditions you specify, starting from a directory you name. For example, you might search for file names that match a certain pattern or that have been modified within a specified time frame.
Unlike most commands, find options are several characters long. You must specify the starting directory before your desired options. In the previous example, directory is the name of the starting directory and options represents the options for the find command.
Each option describes a criterion for selecting a file. A file must meet all criteria to be selected. The more options you apply, the narrower the field becomes. The -print option indicates that you want the system to display the results. The -name filename option tells find to select files that match filename. Here filename is taken to be the rightmost component of a file's full path name. This portion of a file's name is often called the base name. For example, to see which files within the current directory and its subdirectories end in s , type the following command.
Selects files with a rightmost component that matches filename. Surround filename with single quotes if it includes filename substitution patterns. Selects files that are owned by userid. Within escaped parentheses, you can use the -o flag between options to indicate that find should select files that qualify under either category, rather than just those files that qualify under both categories.
In the previous example, the find command searches in the. You can invert the sense of an option by including an escaped exclamation point before the option.
You can also use find to apply commands to the files it selects with the following options. The quoted braces are replaced with the file names that find selects. You can use find to automatically remove temporary work files. If you name your temporary files consistently, you can use find to search for and remove these files.
For example, if you name your temporary files junk or dummy , this command finds and removes the files. For more information on searching for files, see the man page find 1. File permissions help to protect files and directories from unauthorized reading and writing. Often you will have files you want to allow others to read but not change.
In other situations, you might want to share executable files or programs. File permissions enable you to control access to your files. A file must be readable in order for you to examine or copy it. A directory must be readable in order for you to list its contents. A file must be writable in order for you to modify it, remove it, or rename it.
A directory must be writable in order for you to add or delete files in it. A file with executable permissions is one you can run, such as a program. A directory must be executable in order for you to gain access to any of its subdirectories. Group — Other users within the same group as the user, such as all staff members of a particular division.
The system administrator establishes and maintains groups. Use the -l with the ls command to display a long listing of files and directories in alphabetical order. The first character on the line indicates the file type.
A dash - indicates an ordinary file, a d indicates a directory, and other characters can indicate other special file types. The next nine characters indicate the permissions for the file or directory. The nine characters consist of three groups of three, showing the permissions for the owner, the owner's group, and the world, respectively.
The permissions for emptyfile are rw-r--r-- , indicating that the owner can read and write this file, everyone can read it, and no one can execute it.
The permissions for the directory veggies2 are rwxr-xr-x , indicating that everyone has read and execute permissions, but only the owner can write to it. Number of bytes characters in the file. Use the cd command to move to your home directory, and try the ls -l command. Now type the following command, where dirname is the name of an actual directory in your file system. When you give the name of a directory, the ls -l command prints information on all the files and directories in that directory.
0コメント