当前位置:文档之家› Decentralizing UNIX abstractions in the exokernel architecture

Decentralizing UNIX abstractions in the exokernel architecture

Decentralizing UNIX abstractions in the exokernel architecture
Decentralizing UNIX abstractions in the exokernel architecture

Decentralizing UNIX Abstractions in the Exokernel Architecture

by

H′e ctor Manuel Brice?n o Pulido

Submitted to the Department of Electrical Engineering and Computer Science in partial ful?llment of the requirements for the degrees of

Bachelor of Science

and

Master of Engineering in Computer Science and Engineering

at the

MASSACHUSETTS INSTITUTE OF TECHNOLOGY

February1997

c Massachusetts Institute of Technology1997.All rights reserved.

Author

Department of Electrical Engineering and Computer Science

February7,1997 Certi?ed by

M.Frans Kaashoek

Associate Professor

Thesis Supervisor Certi?ed by

Gregory R.Ganger

Postdoctoral Associate

Thesis Supervisor Certi?ed by

Dawson R.Engler

Ph.D.Candidate

Thesis Supervisor Accepted by

Arthur C.Smith

Chairman,Departmental Committee on Graduate Students

Decentralizing UNIX Abstractions in the Exokernel Architecture

by

H′e ctor Manuel Brice?n o Pulido

Submitted to the Department of Electrical Engineering and Computer Science on

February7,1997in partial ful?llment of the requirements for the degrees of

Bachelor of Science

and

Master of Engineering in Computer Science and Engineering

Abstract

Traditional operating systems(OSs)provide a?xed interface to hardware abstractions.This interface and its implementation hurt application performance and?exibility.What is needed is a?exible and high-performance interface to OS abstractions that can be customized to each application’s needs.

To provide more?exibility and performance to applications,the exokernel architecture decen-tralizes OS abstractions and places them in libraries.This thesis investigates how to decentralize OS abstractions while maintaining proper semantics.It also describes the implementation of a prototype library operating system–ExOS1.0–that has enough functionality to run a wide variety of applications from editors to compilers.ExOS1.0serves as an excellent tool for OS research and as a step toward the full understanding of how to design,build,and use library operating systems. Thesis Supervisor:M.Frans Kaashoek

Title:Associate Professor

Thesis Supervisor:Gregory R.Ganger

Title:Postdoctoral Associate

Thesis Supervisor:Dawson R.Engler

Title:Ph.D.Candidate

Acknowledgments

The work presented in this thesis is joint work with Dawson Engler and Frans Kaashoek.It goes without saying that the discussions with Tom Pinckney and Greg Ganger greatly increased the breadth and depth of this work.

I thank the members of the Parallel and Distributed Operating Systems group for withstanding me(Costa and Rusty,why are you smiling?)and providing a joyful research environment.

The painstaking task of reading the whole thesis was endured several times by Dawson Engler, Frans Kaashoek and Greg Ganger.Their invaluable feedback is greatly appreciated.

Dawson Engler is thanked specially for questioning many of the issues covered in this thesis, and poking my brain with his questions and suggestions.Without his feedback,this would have been a truly different thesis.

Tom Pinckney is thanked for answering my numerous questions and listening to all my comments (including the random ones).

My parents are thanked for all their encouragement throughout life and their example of hard work and excellence.

A special thanks goes to the Fundaci′o n Gran Mariscal de Ayacucho and the Venezuelan Gov-ernment for making it possible to enrich my education at MIT.

This research was supported in part by ARPA contract N00014-94-1-0985,by a NSF National Young Investigator Award to Prof.Frans Kaashoek,and by an Intel equipment donation.

4

Contents

1Introduction9

1.1Decentralization Advantages9

1.2Decentralization Challenges10

1.3Solution and Contribution10

1.4Thesis Overview10 2Decentralizing OS Abstractions13

2.1OS Abstractions13

2.2OS Abstractions Semantics14

2.3Centralized OSs Services and Features16

2.4Decentralizing OS Abstractions18 3ExOS1.023

3.1Design23

3.2Experimental Framework:XOK24

3.3Implementation of Major Abstractions and Mechanisms24

3.3.1Bootstrapping,Fork and Exec24

3.3.2Process Management25

3.3.3Signals26

3.3.4File Descriptors26

3.3.5Files27

3.3.6Sockets28

3.3.7Pipes29

3.3.8Pseudo-Terminals29

3.4Performance Evaluation30

3.5Discussion30 4Future Work:ExOS2.033

4.1Design Goals33

4.2Design Description34

4.2.1Local Directories and Files34

4.2.2Sockets35

5

4.2.3Pseudo-Terminals36

4.2.4Signals36 5Related Work37 6Conclusion39

6

List of Tables

3-1Supported File Descriptor Types27 3-2Application Benchmark Results30

7

8

Chapter1

Introduction

It has been widely recognized that traditional operating systems(OSs)should provide much more ?exibility and performance to applications[2,3,4,14].The exokernel architecture is intended to solve the performance and?exibility problems associated with traditional OSs by giving applications protected and ef?cient control of hardware and software resources.Exokernels simply protect resources,allowing applications to manage them.Libraries implementing OS abstractions can be linked with applications to provide programmers the same interfaces as traditional OSs under this architecture.Two major questions of this thesis are“can library operating systems provide the same abstractions as traditional OSs?”and“if so,how?.”This thesis explores mechanisms for providing common OS interfaces while simultaneously maintaining the?exibility and performance advantages of the exokernel architecture.

Traditional OSs enforce abstractions on hardware resources and the software structures used for resource management.They enforce these abstractions by using a well-de?ned system call interface and keeping all system state centralized in a privileged address space.Centralization simpli?es the sharing of system state because all system state is available to all processes when a system call is being serviced.The system call guarantees that the state will not be corrupted or maliciously modi?ed.Unfortunately these advantages come at the cost of?exibility and performance,since ap-plications are forced to use speci?c abstractions with speci?c policies to access hardware resources. For example,disk blocks in UNIX systems are cached,and the cache uses a least-recently-used policy for cache block replacement.Applications that bene?t from either eliminating caching or using a different policy cannot replace this policy under traditional UNIX systems.

1.1Decentralization Advantages

The exokernel OS architecture gives applications more control over resources by decentralizing resource management from the OS into unprivileged libraries(called library operating systems).In contrast to conventional OSs,in which a central authority both protects and abstracts hardware re-sources,exokernels only protect resources,leaving their management to applications.For example, exokernel“processes”manage their own virtual memory.Processes handle page faults,allocate memory and map pages as necessary.This control allows for the implementation of mechanisms

9

such as copy-on-write and memory mapped?les all at user-level.Thus,any of these traditional abstractions can be optimized and customized on a per-process basis.

With the exokernel’s powerful low-level primitives,traditional OS abstractions can be imple-mented in library operating systems.Applications can use a speci?c library OS depending on their access patterns,usage of abstractions,and desired policies.Additionally,if none of the available abstractions are suited for a particular application,unprivileged programmers can safely implement their own abstractions.In this way,libraries provide maximum?exibility and performance to applications.

1.2Decentralization Challenges

To decentralize OS abstractions many problems must be addressed:state that was previously persistent across process invocations may no longer be;shared state can be corrupted by other applications if not properly protected;resources can be accessed concurrently,so there must be mechanisms to guarantee a minimum amount of concurrency control;?nally,since all names manipulated by an exokernel are physical names such as physical page number or a physical disk block,there must be mechanisms to map these names to the logical names commonly used by applications.

The main question then becomes how to implement library operating systems on exokernels. To answer this question,this thesis will explore an implementation of the application programming interface(API)provided by OpenBSD,a BSD-like UNIX OS.This interface provides a widely used set of OS abstractions that,in addition to allowing us to explore the issues in decentralizing OS abstractions,will provide the exokernel prototype with a large application base to test and evaluate the exokernel and library OS architectures.The main challenge of this implementation is conforming to the API while at the same time maintaining the?exibility and performance of the exokernel OS architecture.

1.3Solution and Contribution

This thesis addresses the challenges of decentralizing OS abstractions by?rst exploring what se-mantics they have and how their state is shared.With this information as a foundation,mechanisms for decentralizing OS abstractions are described.Two main approaches are identi?ed:duplicating the mechanisms used under centralized schemes and using mechanisms inherent to decentralized schemes.The insights gained are applied to OpenBSD to create a library operating system called ExOS1.0that provides the same OS abstractions as OpenBSD.ExOS1.0provides enough func-tionality to run a variety of applications from compilers to editors.

1.4Thesis Overview

The remainder of this thesis is organized as follows.Chapter2describes the issues and mechanisms used to decentralize OS abstractions.Chapter3describes the design,implementation and evaluation

10

of ExOS1.0.Chapter4discusses planned future work with library operating systems,including a partial design of ExOS2.0.Chapter5discusses work related to library operating systems and the decentralization of UNIX abstractions.Finally,Chapter6concludes.

11

12

Chapter2

Decentralizing OS Abstractions

This chapter discusses the issues that arise when decentralizing OS abstractions.In order to provide better insight,centralized and decentralized approaches will be contrasted.Although this thesis does not cover all possible OS abstractions,this chapter gives a high-level overview of common OS abstractions in order to make concrete the issues.Semantics de?ne an important part of OS abstractions,therefore the most important semantic issues will be enumerated.In order to contrast centralized and decentralized approaches,the features or abilities of centralized OSs will be described along with examples of how to implement the major abstractions.At this point,the issues and methods to decentralize OS abstractions can be better understood.

This chapter is divided into four sections.Section 2.1describes the general OS abstractions. Section2.2describes the major semantics characteristics of such abstractions,including protection, atomicity,and concurrency.Section 2.3presents some of the features and abilities of centralized OSs and how they relate to the semantics of abstractions.Section 2.4concludes with the mecha-nisms and issues related to decentralizing OS abstractions.

2.1OS Abstractions

To focus the discussion of decentralizing OS abstractions,it is useful to?rst describe some common OS abstractions.This section describes OS abstractions,including some invariants that are enforced in most systems.The abstractions described are divided into four categories:processes,virtual memory,?le systems,and communication.

Processes:A process is basically a program in execution.It consists of the executable program’s data and stack,its program counter,stack pointer,and other registers,and all other information needed to run the program[17].Processes can be suspended and resumed to allow multiple processes to timeshare a machine.There are usually a set of credentials associated with each process that de?ne the resources it is allowed to access.Typically a process can create another process creating a family tree of processes.

Virtual Memory:The abstraction of virtual memory simulates access to larger memory spaces and isolates programs from each other.This is usually done by moving memory

13

pages back and forth between physical memory and a larger backing store(e.g.a disk), and using hardware support to remap every memory access appropriately.For example, when two different processes access memory location5,that location will correspond to a different physical memory addresses for each process,which provides isolation of memory between the processes.The only way processes can share regions of their address space is via explicit sharing.Most OSs provide ways to explicitly setup regions of memory that are shared between processes.The credentials held by the processes can be used to validate the sharing of these memory regions.

File System:File system abstractions permit data to be made persistent across reboots.

Information is stored in entities called?les.Files are usually hierarchically named to simplify and organize?le access.These names are unique and persistent across reboots.Additional information is stored about each?le,like access times and ownership,to allow accounting and to restrict access to the?le.File system abstractions usually involve strong semantics and invariants,because of the many requirements needed to guarantee persistence.For example, all meta-data(information about?les)must be carefully written to a stable storage to guard against inconsistency in case of a power failure.

Communication:Communication abstractions allow processes to exchange information with other processes on the same machine and on other machines in the network.The communication abstractions may have varying semantics,such as guaranteed delivery,best-effort,record-based,etc.Most current OSs do not protect against spoo?ng of communication channels that go over a network,but they do protect communication channels on the same machine.For example,they generally prevent the interception of information sent between two programs by a third program on the same machine.Also,most OSs restrict access to incoming data from the network to only the processes holding that connection.

2.2OS Abstractions Semantics

Now that some common OS abstractions have been laid out,their semantics can be understood.This section explores seven of the main semantic characteristics that OS abstractions deal with in varying degrees:protection,security,concurrency control,naming,coherence,atomicity,and persistence. These semantic issues have to be considered in order to properly implement these abstractions under any scheme,be it centralized or decentralized.In some cases,the actual semantics are more strict than necessary and relaxing them will not change the behavior or the correctness of programs.

Protection:Protection prevents unwanted changes to state.Protection can lead to fault-isolation,and to an abstraction barrier.Fault-isolation is the containment of faults within processes. For example,the process abstraction has fault-isolation,in that the failure of one process does not directly affect any unrelated process.The abstraction barrier protects the state of an abstraction from changes due to methods outside the abstraction.For example,the internal state of most,if not all,UNIX abstractions is protected from processes.Processes are not able see or directly change this state,they can only call the procedures exported by the abstractions.

14

Access Control:Access control de?nes the kind of actions and entities that are allowed to perform these actions.For example,UNIX associates apair with each process.When a process wants to write a?le,the OS compares thepair that is allowed to write with that of the process to determine if the operation is allowed.

Concurrency:Concurrency de?nes the behavior of abstractions when they are simultaneously accessed or acted upon by programs.There are various degrees of concurrency,from none to complete serializability.For example,if?les had no concurrency,it would be acceptable for two simultaneous writes to the same region of the?le to produce the effect of writing any mixture of the two regions written.In contrast,most UNIX OSs use an absolute time semantics,specifying that the later write is what would be seen by the next read of the same region of the?le(if both readers and writers are on the same machine).This absolute time concurrency can be said to be serializable –its outcome can be recreated from some ordering of all?le writes.

Concurrency semantics provide invariants about abstractions that make it easier to reason about their possible states.

Naming:Naming permits unrelated processes to access an object or to communicate with each other.By agreeing on the name,two processes simultaneously or at different times can access the same object.

Naming is used under UNIX for?les,pipes,and sockets.For example,by agreeing on a name beforehand,one process can write to a?le any mysterious events that it detects,and another process later in time can read the same?le and display the results to a user.This behavior is possible because the name associated with the?le does not change through time.

Coherence:Coherence de?nes when and how the abstraction state is well-de?ned.For example, lack of coherence could imply that a change to a?le by one process will not be seen by another process unless the other process explicitly synchronizes the?le.UNIX OSs typically provide strong ?le coherence.If one process writes to a?le,the change can immediately be observed by other processes on the same system.

Atomicity:Atomicity describes the behavior of abstractions interruptions.Strong atomicity guarantees make it easier to reason about and to restore the state of an abstraction after an unexpected interruption(e.g.a power failure).

For example,most UNIX abstractions are atomic with respect to explicit interruptions such as signals.Additionally,UNIX abstractions strive to be atomic with respect to unexpected interruptions such as power failure(although they do not always succeed).For example,?le delete is atomic with respect to unexpected interruptions–the?le is either removed or not.On the other hand, long?le writes are not atomic–if an unexpected interruption occurs only part of the write may be completed.

Persistence:Persistence refers to the lifetime of an object.Objects may have longer lifetimes than their creators.For example,system V shared memory segments persist until explicitly removed. Even if these memory segments are not mapped by any process,the data in them will be available to any process that subsequently maps them.This organization allows processes to share information in memory across invocations.Another more useful example is the exit status of processes.Even after a process has terminated,its exit status will be available until the parent process is ready to use it.In contrast,the data memory of a process is not persistent;it vanishes when the process exits.

15

2.3Centralized OSs Services and Features

Centralized OSs have certain abilities and features that help in implementing OS abstractions and in guaranteeing their semantics.This section summarizes the relevant characteristics of centralized OSs and describes how they are used to implement the semantics discussed in the previous section. The relevant features include:

Controlled Entry Points:Calls into centralized OSs can only occur at well-de?ned entry points(i.e.,system calls),thus guaranteeing that all the guards and proper checks have been executed before changing the state of any abstraction state.Processes in general do not have this characteristic;procedures can be entered at any point.

Different Protection Domains:By executing in a different protection domain,abstraction state can be protected against wild reads and writes.Preventing wild reads ensures that no extra information is revealed about the internal state.Preventing wild writes guarantees that the state is not modi?ed by methods external to the abstraction.This organization provides fault-isolation,because faults outside the abstraction are not propagated into the abstraction except(possibly)through the exported interfaces,which can guard against inconsistent data.

Different protection domains combined with controlled entry points allow one to implement protection by separating the abstraction state from its client and by controlling the methods that modify the abstraction state.Processes can not intentionally or unintentionally modify the state of an abstraction,except through the well-de?ned methods.If a process has a fault, it will not affect the abstraction,except for the fact that the abstraction has to detect the termination of the process and properly clean up its state.

Well-Formed Updates:By having controlled entry points and different protection domains, centralized abstractions can enforce well-formed updates.The abstraction methods are the only ones that can modify the object,and they can only be called at speci?c starting points.

Thus,if they are correct,all updates to the abstraction state will be well-formed.

State Uni?cation:All of an abstraction’s state can be uni?ed in a single location.Preventing multiple copies eases the task of maintaining coherence.For example,in most centralized OSs,only the?le system caches?le blocks,so that no two processes see a different view of the?le(unless they explicitly request this).

Abstractions can control what state processes see and when they see it.The state can be made inaccessible while it is incoherent.For example,?le blocks are usually cached in an OS to avoid repeated access to disk.If one process writes to a cached?le block,other processes that want to read the block will wait for the ongoing write to complete and then read the copy cached by the?le system abstraction.

Atomicity can be implemented in a similar way to coherence.State is not allowed to be seen if an atomic operation affecting that state is in progress.Additionally,UNIX systems provide the notion of signals,a way to interrupt processes.Certain system calls should appear atomic even if interrupted by signals.Abstraction implementations usually wait until all resources

16

for a given operation are available,then they check for any signals.If any signals are pending, the operation is aborted and no state is changed.Otherwise,the operation is carried through until fully completed.For example,if a large?le write request is made,the?le abstraction ?rst checks for the available disk space.If there is enough and it does not have any signals pending,it will start the large write operation.Any process trying to look at the?le at that point will be blocked until the write completes.Additionally,if any signals are posted after the write has started,they are ignored,because undoing the writes is dif?cult on traditional UNIX?le systems.This“guard-action approach”guarantees that the write will appear atomic to all processes.Even the midway point is atomic(unless the system crashes)because no other process will be allowed to see the?le.

Single Point of Serialization:With uni?cation,the centralized OS is a single point for https://www.doczj.com/doc/1e16410829.html,ing standard mechanisms such as locks and critical regions,a centralized OS enforces concurrency semantics of abstractions.Because centralized OSs live longer than most processes,they can release locks even if the relevant process terminates. Concurrency control can be easily implemented with a single point of serialization.Processes accessing an abstraction do so through one or more well-de?ned entry points.The abstraction can block requests if there are requests in progress.For example,if two?le writes operations to the same region of a?le are requested,the?le system abstraction blocks the second until the?rst is?nished,thus,the behavior of concurrent write accesses to?les is well-de?ned. Global Information:With uni?cation of all abstractions in a centralized location,abstractions now have access to information about all processes.This information includes access to information across time.This eases the job of naming and persistence.

In addition,all name resolution takes place at one location:the centralized OS.Together with access to global information,the names can be quickly translated to the underlying object. For example,if a process wants to access a shared memory segment,it will query its virtual memory manager for the segment.This manager in turn can communicate with the shared memory abstraction to locate the segment.Once located,the virtual memory manager for the process can map the segment in the process’s address space.

Expanded Authority:Centralized OSs generally have an expanded authority that regular processes do not have.This authority allows protected and controlled access to powerful resources.

Security is enabled by the fact of global information and strict checks for access.The centralized OS is the holder of all resources and process credentials.It can use these credentials to validate access to resources.The drawback is that improper or missing checks will allow unauthorized access to a resource.This is in contrast to a scenario where the resources and credentials are separated and checks are always done.

Single Point of Update:The centralized OS provides a single point of modi?cation to improve the system and add abstractions.Once this modi?cation has been made,all processes bene?t from the change.

17

Unfortunately,while centralization can simplify the implementation of OS abstractions,it limits ?exibility and performance.Flexibility is limited by providing only one?xed set of abstractions to resources.Thus,any program that could bene?t from a different abstraction for a resource are unable to do so.Performance is limited by in?exibility and strong invariants.For example,if two writes are requested to two different regions of the same?le,the UNIX?le system abstraction will not allow the two writes to take place at the same time in order to guarantee coherency and atomicity.If the processes doing the writes do not require these semantics(e.g.if it is a temporary ?le),they cannot take advantage of this fact to improve their performance.

This problem can be solved by decentralizing of OS abstractions.With appropriately decen-tralized control,abstractions can be better customized and specialized by applications according to their needs.

2.4Decentralizing OS Abstractions

There are two ways to decentralize OS abstractions:partially duplicate the features and abilities of centralized schemes or use the inherent abilities of decentralized schemes to implement the OS abstractions and their semantics in libraries.In some cases,the nature of the semantics required by an abstraction may limit the choices for implementation to centralized schemes.For example,in order to provide absolute coherence,it may be necessary to locate the state in a centralized location to avoid any communication with other holders of the same state.To better explain how semantics and abstractions can be implemented in a decentralized manner,this section presents mechanisms that can be used in decentralized settings and discusses possible implementations of the semantics properties described in 2.2.

The relevant abilities of decentralized OSs are:

Separation:In contrast to centralized operating systems’uni?cation,abstraction state is maintained separately for each process.This organization allows each process to hold and protect its own abstraction state.As in microkernels,a practical consequence is that errors in the OS code no longer crash the system,only the application they are associated with.

Minimized Authority:Minimized authority follows the principle of least-privilege.Each abstraction has control over only its own internal state.Any modi?cation to other abstraction state must be done through explicit interfaces with that abstraction.

Decoupled-changes:In contrast to centralized operating systems’single-point-update,de-centralized OSs decouple changes.This means that changes in the implementation of an abstraction for one process do not directly affect other processes.This structure gives room for?exibility and performance improvements,since the implementation of an abstraction can be optimized and customized for its speci?c usage.

Local Information:If implemented properly,decentralized abstractions work mostly with local information.This organization has the advantage of reliability and scalability.Abstrac-tions rely less on and have less contention for a central repository of information.

18

Until the bulk of the OpenBSD implementation can be done with decentralized state,there are many cases that local information is not enough to implement decentralized OS abstractions. For such cases,state must be shared either across different instances of the abstraction(state uni?cation)or across different abstractions(global information).There are three mechanisms that can be used to share this state:shared memory,exoservers,and in-kernel mechanisms.With shared memory,processes using an abstraction map the abstraction state into the process’address space and act upon it directly.Exoservers are servers that follow the exokernel precept of separating protection from management:they limit their functionality to that required to guarantee invariants and protection,and leave resource management to applications.Finally,in-kernel mechanisms can be used to provide protection that would be impossible with servers or to enhance the performance of commonly used services.

Shared memory is an ef?cient way for processes to communicate with each other and share state. Enforcing semantics on updates to state in shared memory is hard,because there are no guarantees about the code used to modify this shared state(this is not the case for a privileged server or an in-kernel interface).However,some important semantic properties can be achieved.Concurrency can be achieved by using critical regions or non-blocking synchronization mechanisms.Some degree of protection can be achieved by mapping the pages read-only.Additionally,partial copies of the state in shared memory can be stored in each process in case it needs to be reconstructed or to detect corruption.Fault-isolation can be achieved by verifying the validity of data before using it and mapping errors to possible errors under the same UNIX API if data is inconsistent.

Exoservers can provide minimal protection for resources,allowing applications to decide what semantics to use on their abstractions.In this way,?exibility is achieved because programs decide the semantics and ways to access the resources.Performance is achieved,because applications know best how to access the resources and are not?xed by one speci?c interface.For example,a trusted?le server can be used to manipulate the name space for?les,and hand-off permission for further access to that?le to other processes.Processes can then coordinate with the server access to the?le if they want to maintain properties such as atomicity and concurrency,or can directly access the?le,if these semantics are not required by the process.

In-kernel support can be provided for commonly-used functionality to increase ef?ciency and to increase the trust on data held in the kernel or other processes.In-kernel support should only be used for commonly-used mechanisms and should be by-passable by processes.Otherwise,the mechanism could limit future unenvisioned usages of the resource.For example,in-kernel support can be added in order to allow safe,ef?cient sharing of cached disk blocks.In the XOK exokernel, a kernel-maintained buffer cache registry keeps track of mappings betweenpairs and physical pages.This registry is mapped read-only by everyone.For example,a process that wants to read disk block number38can query the registry for its location.If the block is in memory the process can map the physical page it is on.Otherwise,it can fetch the block from the disk and optionally ask the kernel to include it in the cache registry.Note that a process is not forced to use the registry.It is a service that can be bypassed,but it is likely to be used by most processes.

With these abilities and mechanisms for sharing state,the important characteristics of centralized OSs can be duplicated,and the semantics of OS abstractions can be implemented:

19

Protection:Protection can be achieved by storing abstraction state in different protection domains.Either a separate protection domain is used per abstraction as a whole,or processes can hold multiple protection domains each containing partial state of the abstraction.For example,a process could have four different protection domains for the state of the four general classes of OS abstractions.In this way,the states for each abstraction could be completely isolated from each other.Furthermore,the state of the network abstraction for one process could be isolated from that of another process.This organization provides more fault-isolation within the same abstraction.

Access Control:Access Control can be provided via minimized authority.Each process or abstraction only has access to its own state.If it needs to modify or act upon another abstraction,it must do so through explicit interfaces and have credentials that allow it to do so.This approach would provide even better security than is provided in a centralized system, because the effect of a bug is restricted to the authority of the associated abstraction[11]. Concurrency Control:Concurrency control can be achieved either using standard distributed algorithms or duplicating the single-point serialization of centralized OSs via mechanisms such as critical regions and non-blocking synchronization[7].Locks should be avoided under decentralized schemes because it is hard to reason about the current state of the abstraction when a lock holder fails to release the lock(e.g.it crashes before releasing the lock). Naming:Name resolution can either take place in a centralized location,or queries can be passed around until the name fully resolved.A centralized name server can be used,where different processes and abstractions register the names they can resolve.Conversely,only the roots of the names may be registered,and it would be up to the servers to pass any unresolved part of a name to another process for resolution.

Coherency:The easiest way to achieve coherency is by keeping only one copy of the data. Either all of the data is placed in a centralized location,or a registry can be used to allow the data to be in different locations.When an application needs to access new data,it can check the registry.The registry can point to the holder or location of the data or respond that it has no knowledge of it.In the?rst case,the application fetches the data from the location or holder.In the latter case,the application fetches the data directly from the source(e.g.,a disk)and registers itself as the new holder of it.

Atomicity:Atomicity can be implemented similarly to how it is implemented in a centralized scheme.Under centralized schemes atomic semantics are provided by hiding abstraction state until an atomic operation has completed.By their global information and expanded authority properties,if the atomic operation is aborted they can roll-back any abstraction state.The lack of these properties under decentralized schemes make it dif?cult to implement atomic semantics should multiple abstraction need to be updated.

Persistence:Persistence of state beyond the lifetime of a process can be achieved either by using a centralized approach or some form of token passing.Under a centralized approach,a server can hold any persistent state,either through the lifetime of the state or at the point that

20

HP UNIX操作系统管理常用命令

HP UNIX操作系统管理常用命令 2009-02-05 14:41 具体的命令格式和功能可用m a n命令来查看,具体语法是m a n c o m m a n d 1、#i o s c a n-n f:列出各I/O卡及设备的所有相关信息,如逻辑单元号,硬件地址及设备文件名等。 2、#p s-e f:列出正在运行的所有进程的各种信息,如进程号,进程名等。 3、#n e t s t a t-r n:列出网卡状态及路由信息。 4、#l a n s c a n:列出网卡状态及网络配置信息。 5、#b d f:列出已加载的逻辑卷及其大小信息。 6、#m o u n t:列出已加载的逻辑卷及其加载位置。 7、#u n a m e-a:列出系统I D号,O S版本及用户权限等。 8、#h o s t n a m e:列出系统网络名称。 9、#p v d i s p l a y-v/d e v/d s k/c*t*d*:显示磁盘各种信息,如磁盘大小,包含逻辑卷,设备名称等。 10、#v g d i s p l a y-v/d e v/v g00:显示逻辑卷组信息,如包含哪些物理盘及逻辑卷等。 11、#l v d i s p l a y-v/d e v/v g00/l v o l1:显示逻辑卷信息,如包含哪些盘,是否有镜像等。 12、如需修改网络地址、主机名等,一定要用s e t_p a r m s命令 #s e t_p a r m s h o s t n a m e #s e t_p a r m s i d_a d d r e s s 13、查看网卡状态:l a n s c a n 14、确认网络地址:i f c o n f i g l a n0 15、启动网卡:i f c o n f i g l a n0u p 16、网络不通的诊断过程: l a n s c a n查看网卡是否启动(u p) p i n g自己网卡地址(i p地址) p i n g其他机器地址,如不通,在其他机器上用l a n s c a n命令得知s t a t i o n a d d r e s s,然后l i n k l o o p s t a t i o

unix操作基本命令

UNIX系统操作入门篇(一) 这篇东西是关于Unix系统操作的教程。也是Unix的入门教程。如果你有兴趣学,请看下去,保证你可以学到许多有用的东西。如果你满足于dos,windows的操作,不想对网络服务器,有任何了解的话,可以不看。因为你并不想成为计算机高手。本教程仅仅讲授Unix系统的常用命令,不涉及Unix的历史、安装和编程。如果你想得到更多的知识,请查找其他的教材。本教程参考了《精通Unix》、《Unix基础》、《Unix系统使用指南》等书,你可以在那里找到更多的知识。 准备知识: Unix是一个多任务多用户的操作系统。多任务是指可以同时运行几个不同的程序,或命令。在操作系统的术语里叫“进程”,就象在运行Windows95的时候我们可以一边听CD 一边打字,同时打印机还在工作。多用户是指一台运行Unix系统的机器可以同时具有几个不同的输入输出设备,给几个,几十个用户同时使用。不同的输入输出设备我们称为终端。Unix 给每个终端设置不同的序号以协调工作,这个序号被称为终端序号。Unix是一个根本不同于Dos的系统,无论其命令格式,用途都和Dos有很大区别。比如:目录分割符是"/",而不是"\"。具体的不同请参考其他书籍。 开始练习之前: 在开始教授Unix命令之前,请先记下这个地址:https://www.doczj.com/doc/1e16410829.html,。它是一台在美国的,连上Internet的Unix主机。之所以告诉大家这个地址是因为它提供免费的帐号供大家使用。是免费的。就是说你可以先去那里申请一个帐号,然后在那里练习你所学到的Unix 命令。因为我相信不是每个朋友都可以轻松地得到Unix帐号的。在你成功的申请好帐号之后,请在你Windows95的dos窗口里输入"telnet https://www.doczj.com/doc/1e16410829.html," 等待连上主机。接下来就是输入你的用户名和密码,不要告诉我这些你都不会,如果你不会的话,你是怎么连到这个网页的?现在假定你连上了主机,系统的提示符应该是"https://www.doczj.com/doc/1e16410829.html,%",对这个就是提示符就象dos里的"c:\>"。接下去我将开始命令篇。 ls 你记不记得你学会的第一个Dos命令?反正我学会的第一个命令是dir:列目录和文件的命令。你学会的第一个Unix的命令也是列目录和文件的命令ls. 功能列出当前目录下的文件和目录。同Dos一样,Unix系统命令也是带参数的。ls的参数有"a","l","F"。请注意,F是大写。Unix系统里对命令的大小是严格区分的。(所以我们做网页常常会发生连接错误)同dos 不一样的地方在于,Unix命令的参数是"-"为其前导,而不是"/"。所以完整的ls命令是 ls -l -a -F或ls -laF -l:long的意思,把文件的其他资料,如文件长度,上次修改的日期等等列出来。 -a:all的意思,把本目录下所有的文件,包括隐含的文件也列出来。 -F:显示文件类型。"*"表示可执行文件,"/"表示目录,"@"表示连接。 好,请在你的机器上输入ls -l -a -F,或许这是你一生里第一个Unix命令。记住了吗? cd 变换目录,和Dos相同。如果你在cd后面没有给定目的地,则表示目的地是家目录。在unix 中有三中表示目录的符号".","..","~"。"."表示当前目录路径的位置".."表示当前路径的上一层目录,或称"父目录" "~"表示家目录,所谓家目录指系统管理员分配给你的目录,比如你的用户名是li,那么你的家目录就是在"~li",在cd后面加上"~li"就是去你的家目录。 date 显示出当前的时间和日期,记住在Unix里你是无法修改系统时间的。输出时间一般是格林

SCO_UNIX系统常用命令.

SCO UNIX 系统常用命令 一. 常用系统命令 1. 登录 在login :下,输入用户名,密码,进入显示shell 名令提示符,超级用户#>,普通用户$>. 2 su #>su -oracle 3 退出 exit logout ctrl +d( 强制退出 4 passwd修改密码 5 man查命令的解释 6who 查看登录用户,包括自己。 Who am I 7finger 显示当前用户的信息。 8clear 清屏 9setcolor -n 置屏幕为normal , 黑底白字。 10wall 广播信息 wall -》回车-》输入内容-》ctrl +d mail 发送邮件

mail 接收用户名-》回车-》输入内容-》ctrl +d 11关机 shutdow n -g0 —立即关闭无需确认 haltsys reboot init 0 关机 init 6 停止系统运行并重启 12du dfspace du :显示文件目录占用的磁盘空间大小。 Dfspace: 显示空闲磁盘空间。 13scoadmin系统管理工具 14u name —显示系统信息 15env 显示更改环境设置 set 16sar系统维护的重要工具 /usr/lib/sa/sar_e nable-y 打开 /usr/lib/sa/sar_e nable—n 关闭 从14个方面报告系统的活动情况,重点监视内存和cpu的使用情况.sar -r 30 4 报告内存和交换区的使用

sar -u 30 4报告cpu的使用情况 Wio 值高表示硬盘存在IO 瓶颈 Idle 值高表示等待分配内存, 需扩内存小于30表示进程主要竞争的自源是cpu. ipcs 显示共享内存 ipcrm -m(s id 号 integrity 把文件控制数据库与文件系统中的文件, 进行比较. Fixmog 使全部的系统文件或指定的系统文件和鉴别数据库一致起来. 二. 文件目录相关命令 1 pwd 显示当前所在目录 2cd 3mkdir 创建目录 4rmdir 删除目录 5rm 删除文件 rm —r 6mv 源目标 7cp 源目标 cp -r 8ln 源目标文件的链接 9pg 文件

SCO_UNIX系统常用命令.

SCO UNIX系统常用命令 一. 常用系统命令 1. 登录 在 login :下,输入用户名,密码,进入显示 shell 名令提示符,超级用户 #>,普通用户$>. 2 su #>su – oracle 3 退出 exit logout ctrl +d(强制退出 4 passwd 修改密码 5 man 查命令的解释 6who 查看登录用户,包括自己。 Who am I 7finger 显示当前用户的信息。 8clear 清屏 9setcolor – n 置屏幕为 normal , 黑底白字。 10wall 广播信息 wall -》回车-》输入内容-》 ctrl +d mail 发送邮件

mail 接收用户名-》回车-》输入内容-》 ctrl +d 11关机 shutdown – g0 – y 立即关闭无需确认 haltsys reboot init 0 关机 init 6 停止系统运行并重启 12du dfspace du :显示文件目录占用的磁盘空间大小。 Dfspace: 显示空闲磁盘空间。 13scoadmin 系统管理工具 14uname – X 显示系统信息 15env 显示更改环境设置 set 16sar 系统维护的重要工具 /usr/lib/sa/sar_enable – y 打开 /usr/lib/sa/sar_enable – n 关闭 从 14个方面报告系统的活动情况 , 重点监视内存和 cpu 的使用情况 . sar – r 30 4 报告内存和交换区的使用 .

sar – u 30 4 报告 cpu 的使用情况 . Wio 值高表示硬盘存在 IO 瓶颈 Idle 值高表示等待分配内存 , 需扩内存小于 30表示进程主要竞争的自源是cpu. ipcs 显示共享内存 ipcrm -m(s id 号 integrity 把文件控制数据库与文件系统中的文件 , 进行比较 . Fixmog 使全部的系统文件或指定的系统文件和鉴别数据库一致起来 . 二. 文件目录相关命令 1 pwd 显示当前所在目录 2cd 3mkdir 创建目录 4rmdir 删除目录 5rm 删除文件 rm – r 6mv 源目标 7cp 源目标 cp -r 8ln 源目标文件的链接

UNIX系统常用命令

UNIX系统常用命令 UNIX系统常用命令格式: command [flags] [argument1] [argument2] ... 其中flags以-开始,多个flags可用一个-连起来,如ls -l -a 与ls -la相同。 根据命令的不同,参数分为可选的或必须的;所有的命令从标准输入接受输入,输出结果显示在标准输出,而错误信息则显示在标准错误输出设备。可使用重定向功能对这些设备进行重定向。 命令在正常执行结果后返回一个0值,如果命令出错可未完全完成,则返回一个 非零值(在shell中可用变量$?查看). 在shell script中可用此返回值作为控制逻辑的一部分。 注:不同的UNIX版本的flags可能有所不同。 1、与用户相关的命令 1.1 login (在LINUX Redhat下此命令功能与Solaris/BSD不同,执行login会退出当前任务). login: Password: 相关文件: 在下面的这些文件中设定shell运行时必要的路径,终端类型,其他变量或特殊程序. $HOME/.profile (Bourne shell, sh, bash) $HOME/.cshrc (csh, tcsh) $HOME/.tcshrc (tcsh) /etc/passwd文件中列出每个用户的shell /etc/csh.cshrc /etc/csh.login /etc/profile (Bourne shell, bash) /etc/login (Bourne shell, bash) csh: /etc/csh.cshrc和$HOME/.cshrc每次执行都会读取, 而/etc/csh.login和$HOME/.login只有注册shell才执行 修改相应文件后使用 source .cshrc使能相关修改,如果修改了path则 还需使用rehash刷新可执行文件hash表。 tcsh: $HOME/.tcshrc, 没有些文件读取.cshrc sh: /etc/profile和$HOME/.profile注册shell bash: /etc/profile和$HOME/.bash_profile注册shell读取 .bashrc交互式非注册shell才读取。

UNIX 常用命令

6.dd 删除一行文本所用的操作符 7.10x 删除10个字符所用的操作符 8.. 点重复用户最近一次文本修改 9.$ 移动光标到当前行尾 10.W 将光标向右移动一个字 11.K 将光标向上移动 12.j 将光标向下移动 13.h 将光标向左移动 14.l 将光标向右移动 15.A 在当前行尾输入文本 16.O 在当行上面添加一行 17.o 在当前行下面添加一行 18.U 撤销对当前行所做的所有修改 19.r 替换光标所在位置的字符 20./ 向前搜索指定的字符串 21.?向后搜索指定的字符串 22.:q! 不保存文件,退出vi 23.a 将输入的文本插到光标位置处 24.0(零)将光标移到当前行首 25.ls 列出当前目录的内容 26.pwd 显示当前目录的路径名 27.cd 改变当前目录到主目录 28.mkdir xyz 在当前目录下创建xyz 目录 29.ls-l 以长格式列出当前目录 30.cd.. 改变当前工作目录到当前目录的父目录(改变到了另一个目录) 31.ls-a 列出所有文件包括隐藏文件 32.cat xyz 在屏幕上显示xyz 文件的内容 33.lp xyz 在默认打印机上打印xyz文件 34.rm xyz 删除xyz文件 35.rmdir xyz 删除xyz 目录 36.cancel lp1 取消lp1打印机上的打印作业 37.lpstat 显示默认打印机的状态 38.rm-i 在删除文件之前要求确认 39.rm 删除文件 40.rmdir 删除目录 41.lp 打印文件 42.Cancel 取消打印请求 43.Lp-n 打印文件的多份副本 44.cd 改变到主目录 45.mkdir 创建目录 46.mkdir-p 创建两层目录结构 47.cd 改变到根目录下 48.cat- 在屏幕上显示文件 49.cat-- 在屏幕上显示两份文件 50.G 将光标放在文件的最后一行上 51./most查找字most 52.[Ctrl-g] 显示当前的行号 53.2dw 删除两个字 54.“x4yy 复制4行到缓冲区x中 55.66G 将光标定位到第66行 56.rx 用字母xti替换光标处的字符 57.“lp 查看缓冲区的1的内容 58.:set number 设置行号选项 59.“x5yy 保存5行到缓冲区X 60.:r!date 将日期串读入(输入)用户文件中 61.:!ls 列出当前目录 62.:ab 创建缩写 63.:unab 取消缩写68.mv xxx yyy 将xxx重命名为yyy 69.rm* 删除当前目录下的所有文件 70.ls*[1-6] 列出所有文件名以数字1-6结尾的文件 71.cp file??source 复制所有文件名以file开头,后面跟两个字符的文件 72.pr-2 myfile 以两列格式化myfile 73.pg myfile 以逐屏显示的方式浏览myfile 74.cat myfile>yyy 复制myfile到yyy 75.cat?myfile>>yyy 将所有文件名为myfile前加一个字符的文件内容加到yyy文件中 76.find.-name“file*”-print 查找所有文件名以file开头的文件 77.find-name xyz-size20-print 查找所有文件名为xyz大小为20块的文件 78.cut-f2 xyz>xxx 保存xyz文件的第2个域到xxx文件中 79.more zzz 逐屏读zzz文件 80.alias 该命令创建命令的别名 81.ls-i 列出当前目录下的文件名及其i节点号 82.echo 该命令在输出设备上显示其输出参数 83.\a 警报(响铃) \n 回车换行 \b 回退 \r回车不换行 84.echo A>>B 把A追加到B 1.编辑器:编辑器是一个工具,可以方便的创建新文件或修改旧文件 2.UNIX操作系统支持的编辑器:(行编辑器)Emase,ex,ed,(全屏编辑器)vi,view /* 3.x 删除光标出的字符 r 替换光标所在位置的字符 / 向前搜索指定的字符串 ? 向后搜索指定的字符串 h 将光标向左移动一行 A 将输入文本放在当前行的行尾 q! 不保存文件,退出vi wq 保存文件并退出vi a 将输入的文本插入到光标位置后 $ 将光标移到当前行行尾 0 将光标移到当前行行首 K 将光标向上移动一行 4.dd 删除一行 dw 删除1个字 yy 复制1行 yw 复制1个字 d$ 删除到当前行尾 :z2yy 将两行保存到缓冲区z “zp 将缓冲区z的内容复制到当前行后 “2p 将缓冲区2的内容复制到当前行后 5.G 将光标放到文件的最后一行上 /most 查找字most [Ctrl-g] 显示当前行的行号 2dw 删除两个字 j 将光标向下移动一行 “x4yy 复制4行到缓冲区x $ 将光标定位到当前行尾 0(零)将光标定位到当前行首 66G 将光标定位到第66行 x 删除光标出的字符 rx 用字母x替换光标出的字符

UNIX常用命令简介

UNIX常用命令简介使用说明: 除斜体字部分外,其它要求新员工全部掌握。修改记录: 2000年12月26日第一版

目录 4第0章建立自己的环境 1、CSH4 2、BSH/SH4 3、KSH4 4第一章目录及文件操作 1、ls4 2、pwd5 3、cd5 4、mkdir5 5、more5 6、cp5 7、mv6 8、rm6 9、chmod6 10、chown7 11、diff7 12、wc7

13、touch7 14、find8 15、grep8 16、vi9 15第二章设备管理 1、mount15 2、umount15 3、tar15 4、du16 5、ioscan16 6、cpio16 16第三章进程管理 1、ps16 2、kill16 17第四章系统管理和用户 管理 1、who17 2、passwd17 3、su17

4、date17 5、shutdown17 6、echo18 7、env18 8、uname18 9、netstat18

第0章建立自己的环境 1、CSH 在使用C-SHELL时,有两个环境文件需要配置:.cshrc 和.login(以“.”开头的文件通常的情况下是隐藏的,可以采用命 令“ls -a”查看)。 .cshrc设置说明 umask 027 # 设置创建文件时的缺省权限 set history = 32 # 设置需要记忆的历史命令数目 setenv WORK_DIR $HOME # setenv 用于csh设置环境变量 setenv TERM vt100 # 设置终端类型 setenv PATH /opt/softbench/bin:/usr/bin/X11:/usr/c++/bin:/usr/contrib/bin: \ /usr/local/bin:/usr/contrib/bin/X11:/usr/local/bin/X11: \ /opt/ansic/bin:/opt/nettladm/bin:/opt/graphics/common/bin: \ /opt/upgrade/bin:/opt/CC/bin:/opt/langtools/bin:/opt/imake/bin: \ ${PATH}:.:${INFORMIXDIR}/bin:${INFORMIXDIR}/lib/esql # 设置执行搜索路径 .login设置说明 stty erase "^H" kill "^U" intr "^C" eof "^D" susp "^Z" \

《UNIX常用命令大全》word版

UNIX常用命令大全[分享] apropos 用途:apropos查找使用说明的名称。 举例:apropos print(等价于man -k prink)。 arch 用途:arch获得机器体系结构的描述信息。 举例:arch。下面是arch输出的结果: sun4 将这个命令与uname进行比较。 ash 用途:ash是外壳,只用于某些系统。 举例:ash。这个命令启动ash外壳的一个实例。 at 用途:at用于确定命令执行的时刻。 举例:at 9:00am December 31。 awk 用途:awk是一种模式扫描和执行语言。 举例:awk\'{print $1}\'file.txt。这个命令执行后将打印出file.txt的第一个区域。bash 用途:bash是GNU Bourne-Again外壳。 举例:bash[options]。这个命令启动bash外壳,它是一个增强的和sh兼容的外壳。bash 的提示符为$。 biff 用途:biff通知你是否收到了邮件。 举例:biffy。这个命令叫biff通知你新邮件什么时候到达(注意,要想让biff工作,你必须同时运行 sendmail)。 cancel 用途:cancel取消挂起的打印作业。 举例:cancel23。这个命令取消23号打印作业。 cal 用途:cal显示无格式文本日历。 举例:cal。以下是命令执行后输出的列表: August 1998 cat 用途:cat将文件连接在一起并显示这些文件中的内容。 举例:cat myfile.txt。这个命令执行后显示myfile.txt中的内容。 cc 用途:cc是用于许多系统的C编译器。 举例:cc myfile.c -o myfile。这个命令执行后对myfile.c源文件进行编译并输出一个名为myfile的可执行文件。 cd 用途:cd用来改变当前目录。 举例:cd/usr/bin。这个命令执行后将当前目录更改为/usr/bin。

UNIX操作系统常用命令使用方法

UNIX系统及BSJ2200系统培训 第一章SUN系统介绍 第一节SUN的发展史 (一)硬件体系 81--89 Sun1/2/3 CISC Motrala 680x0系列 89--94 Sun4/60 sparc1 Risc sparc 65 sparc1+ 70 sparc2 Server : Sun/290/670/690 93--96 Sparc10/20 SuperSparc Server : 1000/2000 96--97 Ultra1(140/170/170E/200E) UltraSparc SBUS体系结构,UPA接口 Ultra2 Server : E150,E3000 98--99 Ultra5 ,Ultra10 PCI体系结构(IDE外设) Ultra30,Ultra60 Server : E250,E450,E3500 2000-至今BLADE 150/2000/2500 (二)软件体系 Solaris 1.x SunOS 4.1.3+OpenWindow 1.x BSD Solaris 2.x System V 32bit 2.5.1 SunOS 5.5.1 +OpenWindows 2.6 SunOS5.6+CDE1.2 Solaris 2.7(7) 64 bit Solaris 2.8(8) for sparc平台/intel x86平台 Solaris 2.9(9) for sparc平台/intel x86平台 第二节SUN系统的安装 以SUN Ultra5(9.1G)硬盘Solaris2.7为例,步骤如下: 1、在OK提示下输入:boot cdrom 2、出现“Select Language and local”时,选择“Continue”按钮。 3、出现“The Solaris installation program”时,选择“Continue”按钮。 4、出现“Identify this system”时,选择“Continue”按钮。 5、出现“Hostname”时,先输入机器名后,再选择“continue”按钮。 6、出现“Network connectively”时,先选择“Yes”,再选择“Continue”。 7、出现“IP Address”时,输入IP后,选择“Continue”。 8、出现“Confirm Infirmation”时,选择“Continue”。 9、出现“Name service”时,先选择“None”后,再选择“Continue”。 10、出现“Confirm Infirmation”时,选择“Continue”。 11、出现“Subnets”时,先输入“NO”,再输入“Continue”。 12、出现“Time Zone Geographic region”时,输入“Set”。 13、出现“Geographic region”时,选“Asia Eastern HongKong”。

UNIX命令

入门介绍和常用命令 如果文件系统磁盘空间不足,则可能出现停止服务等反常现象。 建议各现场系统环境维护人员要定期检查一下Domain所在文件系统的磁盘空间是否足够。命令: df -k df -m df -g等。 历史: BSD,SYSTEM V 主流商业版本 SUN SOLORIS IBM AIX HP-UX Tru64 UNIX LINUX 登录和用户管理 进入系统 login: passwd: 字符方式: 字符终端(console,tty) telnet,term-tools 图形方式(x-window protocal): 从主机登录; 图形终端工具(reflection,hummingbird,cygwin,etc.) Change passwd: $ passwd old password: new password: reenter new password: chsh $ chsh /bin /sh /bin /csh User informaiton defined in /etc/passwd,readonly for ordinary users.

$ man cmd $ docsearch $ wheris cmd $ which cmd Command Search Path $ echo $PATH 查看自己的用户名 $ whoami who ,w 查看当前谁在系统上 users, u 查看当前系统的用户 id 看登录用户 finger user 查看user 的信息 ps 显示当前进程状况 ps –u user 显示用户名为user 的进程状况 进程调度 后台运行 $ cmd & $ cmd1;cmd2;cmd3 $ cmd1&&cmd2&&cmd3 $ cmd1||cmd2||cmd3 从后台转到前台 $ jobs #查找 $ fg %n 定时任务 at,cron $ at time cmd $ crontab –l $ crontab –e $ crontab user # root can edit other users? crontab 重定向和管道 stdin,stdout,stderr $ cmd >file $ cmd

unix常用命令

UNIX常用命令 以下只说明各常用指令的基本用法, 若需详细说明, 请用 man 去读详细的 manual. 1.关於档案/目录处理的命令 ls——列目录 这是最基本的档案指令。 ls 的意义为 "list",也就是将某一个目录或是 某一个档案的内容显示出来。 格式:ls -1ACFLRabcdfgilmnopqrstux -W[sv] [files] 例: #ls (不跟任何参数以简单格式列出当前目录中所有档案) #ls bin (简单格式列出名为bin的文件或目录下的所有档案) #ls /u/ilasII_GB/lib (全路径,列出lib目录下的所有档案) ls 的常用参数如下: -a : 在 UNIX 中若一个目录或档案名字的第一个字元为 "." , 则使用 ls 将不会显示出这个档案的名字,我们称此类档案为隐藏档。如 .profile、.tcshrc等 如果我们要察看这类档案,则必须在其后加上参数 -a 。 -l : 这个参数代表使用 ls 的长( long )格式,可以显示更多的资讯,如档案存取权,档案拥有者( owner ),档案归属组,档案大小,档案最後更新时间,甚而 symbolic link 的档案是 link 那一个档等等。显示结果如下所示: drwxrwxrwx 30 root bin 1024 May 23 10:38 u drwxrwxrwx 2 root sys 512 Jul 28 1999 uacn drwxrwxrwx 5 root sys 512 Jul 27 1999 udk lrwxrwxrwx 1 root sys 11 Jul 27 1999 unix -> /stand/unix drwxrwxrwx 35 root auth 1024 Apr 3 13:45 usr 在开始的10个字符上系统给出文件的用户权限。该序列分成四个域。第一个字符为类型域,第2、3、4个字符为用户主域,第5、6、7个字符为同组用户域,第8、9、10个字符为其它用户域,域中字符的含义如下: ●在类型域中: d 表示此文件是一个目录 -表示此文件是一个普通文件 b 表示此文件是一个特殊的块设备I/O文件 c 表示此文件是一个特殊的字符设备I/O文件 l 表示此文件是一个连接文件。在其文件名称后紧跟与它连接的文件路径及名称。如: unix -> /stand/unix ●在“用户主”、“同组用户”、“其它用户”域中: r 表示有读权限。含义是可以拷贝或显示该文件或目录中的内容。 w 表示有写权限。含义是可以改变或修改该文件。 x 表示有执行权限。含义是可以执行该文件或用cd命令进入该目录,在该目录中建立文件或子目录等。 -表示无权限。

unix-100条基本命令

UNIX 操作入门和100多个命令 unix 入门 ..登录步骤 ========= login : _______ => 输入username password : _______ => 输入密码 ..退出步骤 ========= % logout 或% exit 或% 更改帐号密码 ============ % passwd => 执行后将会出现下列讯息 Changing NIS password for user on ice. Old password: ______ => 输入旧密码 New password: ______ => 输入新密码(最好6-8字,英文字母与数字混合) Retype new password: ______ => 再输入一次密码 在线指令说明 ============ 执行格式:man command-name Example: % man ls 进入远端电脑系统 ================ 执行格式:rlogin hostname [-1 username] Example: %rlogin doc remote login 进入工作站doc 中。 %rlogin doc -l user 使用user 帐号进入工作站doc 中。 执行格式:telnet hostname 或telnet IP address Example: %telnet doc or %telnet 140.109.20.251 文件或目录处理 ================== .列出文件或目录下之文件名称 执行格式:ls [-atFlgR] [name] ( name 可为文件名或目录名称。)

UNIX系统调试常用命令

solaris系统常用命令: 一、OK状态下的命令 在多用户状态下运行init 0 或按stop+A键可以进入OK状态, 格式: OK> 指令 (一)、显示环境参数 1、banner 显示当前机器配置状况,CPU,内存,hostid,EtherNet 2、devalias 显示设备别名,如 cdrom,disk,disk0,disk1等 3、printenv 无参数,显示环境变量;参数为环境变量名,显示变量值 如: printenv auto-boot? (二)、显示挂接的设备 1、probe-scsi 显示内部SCSI通道所挂接设备 2、probe-scsi-all 显示所有SCSI通道及所挂接设备 3、probe-ide 显示所有IDE通道及所挂接设备(针对U10,U5) (三)、设置环境变量 1、setenv 设置环境变量,如: setenv auto-boot? false 3、set-defaults 恢复所有环境变量预定值 设置完环境变量后必须运行reset-all,所设置的变量才保存下来(四)、其他命令 1、boot device option 启动主机 device可以为:设备别名: cdrom 或 disk 也可以为:设备名: /pci@1f,4000/scsi@3,1/disk@6,0:f option可以为 -r 设备重新配置 -s 系统重启到单用户状态 2、eject cdrom|floppy 弹出cdrom或floppy 3、test net:测试网络设备(网卡) 4、power-off 关机 二、系统多用户状态下的常用命令 1、如何查看cup的状态? # psrinfo -v # mpstat 可以列出多cpu负载的状态

unix基本命令

unix常用命令 a. 关於档案/目录处理的指令: 1. ls 这是最基本的档案指令。 ls 的意义为 "list",也就是将某一个目录或是某一个档案的内容显示出来。 如果你在下 ls 指令後头没有跟著任何的档名,它将会显示出目前目录中所有档案。 也可以在 ls 後面加上所要察看的目录名称或档案的名称,如 % ls /home2/X11R5 % ls first ls 有一些特别的参数,可以给予使用者更多有关的资讯,如下: -a : 在 UNIX 中若一个目录或档案名字的第一个字元为 "." , 则使用 ls 将不会显示出这个档案的名字,我们称此类档案为隐藏档。如 tcsh 的初设档 .tcshrc;如果我们要察看这类档案,则必须加上参数 -a 。 -l : 这个参数代表使用 ls 的长( long )格式,可以显示更多的资讯, 如档案存取权,档案拥有者( owner ),档案大小,档案最後更新 日期,甚而 symbolic link 的档案是 link 那一个档等等。如下 % ls -l drwx--x--x 2 jjtseng 512 Aug 8 05:08 18 drwx--x--x 2 jjtseng 512 Aug 8 22:00 19 -rw------- 1 jjtseng 566 Aug 8 05:28 makefile 2. cp cp 这个指令的意义是复制("COPY") , 也就是将一个或多个档案复制成另 一个档案或者是将其复制到另一个目录去。 cp 的用法如下: cp f1 f2 : 将档名为 f1 的档案复制一份为档名为 f2 的档案。 cp f1 f2 f3 ... dir : 将档案 f1 f2 f3 ... 都以相同的档名复制一 份放到目录 dir 里面。 cp -r dir1 dir2 : 将 dir1 的全部内容全部复制到 dir2 里面。

UNIX操作基本命令

UNIX操作基本命令 (一)基本命令 1. ls 显示文件名,等同于dos下dir命令 命令格式:ls [option] file option : 域1: 文件类型和文件权限 域2: 文件连接数 域3: 文件所有者名字 域4: 文件用户组名字 域5: 文件长度 域6-8: 最近修改日期 域9: 文件名 -a 显示所有义件,包含隐臧文件(以 .起头的文件名) -R 显示文件及所有子目录 -F 显示文件(后跟*)和目录(后跟/) -d 与l选项合用,显示目录名而非其内容 2. cd 目录转换,等同于dos下cd命令 注意目录分隔符为"/,”与dos相反 命令格式:cd dirname 3. pwd 显示当前路径 4. cat 显示文件内容,等同于dos下type命令 命令格式:cat filename 5. more 以分页方式查看文件内容 命令格式:more filename 6. rm 删除文件 命令格式:rm [-r] filename (filename可为档名,或档名缩与符号。)例子: rm file1 删除档名为file1之文档。 rm file ? rm f* rm -r dir1 7. mkdir 创建目录删除档名中有五个字符,前四个字符为file之所有文档。删除档名中,以f为自首的所有文档。 删除目录dir1,及其下所有文档及子目录。 命令格式:mkdir 例子: [-p] directory-name

mkdir dirl 建立新一级目录dirl mkdir -p dir/subdir 直接创建多级目录 8. rmdir 删除目录 目录必须首先为空 命令格式: rmdir directory 9. cp 文档复制 命令格式:cp [-r] source destination cp file1 file2 将文档file1复制成file2 cp file1 dir1 将文档file1复制到目录dir1下,文件名仍为file1 cp /tmp/file1. 将目录/tmp下的文档file1复制到现行目录下,档名仍为file1 cp /tmp/file1 file2 将目录/tmp下的文档file1复制到现行目录下,档名为file2 cp -r dir1 dir2 (recursive copy)复制整个目录右目录dir2存在,则将目录dir1 , 及其所有文档和子目录复制到dir2目录下,新目录名称为dri1。若 目录dir2不存在,则将dir1,及^文档和子目录,复制为目录dir2。 10. mv 文件移动 命令格式:mv source destination mv file1 file2 将文档file1,更改档名为file2 mv file1 dir1 将文档file1,移到目录dir1下,档名仍为file1 mv dir1 dir2 若目录dir2存在,则将目录dir1,及其所有档案和子 目录移到目录dir2下,新目录名称为dir1,若目录dir2 不存 在,则将dir1 ,及其所有文档和子目录,更改为目录dir2。 11. du 查看目录所占磁碟容量 命令格式:du [-sk] directory 例子: du dir1 显示目录dir1的总容量及其次目录的容量 du -sk dir1 显示目录dir1的总谷重,以k bytes为计重 12. find 文件查找 命令格式:find dir -name filename command 例子:

UNIX系统开发-sdb命令使用:程序执行控制

UNIX系统开发-sdb命令使用:程序执行控制 我们说程序调试的主要目的是观察变量的变化情况。但如果程序就一直不停地运行直至它终止或出错时才停下来的话,将没有机会去观察任何变量。因此,如何有效地控制程序中各语句的执行,使之在适当的时候暂停下来,待调试人员在显示或设置了某些存储单元的值之后再从停下的地方继续执行下去,是调试程序应具有的一项基本功能。在这一节中我们就来具体介绍如何控制程序的运行。 对程序执行控制的第一个问题是设置断点。一个断点实际上就是程序中某行语句。当程序执行到这条语句时控制会重复返回到sdb,由此提供给用户进行其他操作,如显示变量值的机会。 1.断点的设置和删除 在sdb中设置断点的方法比较多。但基本是b命令的变种。例如,我们可以使用如下语句在main()函数的第一个可执行行(非变量定义这类语句)设置一个断点: * main:b 也可以直接用行号来设置断点。例如,在myprog.c中,第10行是main()函数中的第一个可执行语句,则使用如下命令也能达到同样的效果: * 10b 注意这是在myprog.c为当前文件的情况下进行的。 如果直接输入: * b 命令,则可将当前行设成是一个断点。但是若当前行不是一个可执行语句,那么sdb将把当前行之后的第一个可执行语句处设置一个断点。 在设置完断点之后,为了解程序中设置有哪些断点,可以使用B命令: * B

0x80483f0 myprog.c:10 main+0x8 0x80483f7 myprog.c:11 main+0xf 0x8048407 myprog.c:12 main+0xlf 0x8048440 myprog.c:9 T estInput 0x8048447 myprog.c:10 TestInput+ 0x7 0x804482 myprog.c:13 T estInput+ 0x42 在设置完断点之后要将其删除,可以使用d命令。如: * main:d sdb将把在main()函数中设置的第一个可执行行上的断点删除。如果直接使用d命令,sdb 将逐个列出所有断点并询问用户是否删除之。回答y断点将被删除。使用D命令则可删除程序中设置的所有断点。 2.sdb中启动程序的运行 在设置好所需的断点之后我们就可以重新启动程序的运行了。这可以使用r命令。如: * r 111 2 BREAKPOINT process 554 function main() in myprog.c 10: for(i=1;i

UNIX系统操作命令(1)

UNIX系统操作命令; 第一章登录和退出 1.1 登录 当屏幕上出现Login提示符时,用户可以输入自己的用户注册名,并按回车键。 若有口令,系统将提示用户输入密码,并按回车键,口令输入正确后,用户登录成 功。这时,屏幕上会显示出一些信息和命令提示符。如: Login: guest [Enter] passwd: ****** [Enter] sun% 注: 用户名要用小写字母输入,UNIX系统区分大小写字母。 1.2 退出 当用户准备退出自己的计算机帐号时,可在系统示符下输入logout或exit 或按 [Ctrl-D]。当屏幕出现Login时,用户可以安全地离开计算机了。如:sun% logout [Enter] Login: 1.3 修改口令

为了防止他人使用自己的帐号,在你首次登录后,请用passwd命令修改只有本 人知道的保密口令,口令通常由此可6到8个字母数字组成。如:sun% passwd [Enter] Old Passwd: ****** New Passwd: ****** Retype New Passwd: ****** 注:当你退出系统再次登录时,就要使用新的口令。 第二章目录操作命令 2.1 显示目录 命令:pwd(print working directory) 格式:pwd 功能:显示出用户当前工作目录的全路径名。 例如:% pwd 2.2 建立目录 命令:mkdir(make directory) 格式:mkdir directory_name 功能:建立新目录

2.3 改变目录 命令:cd(change directory) 格式:cd directory_name 功能:改变当前工作目录 注释:目录名选项有: (1) 目录名,转到当前目录下的子目录。 (2) .. 表示转到当前目录的父目录。 (3) / 表示转到根目录。 (4) 没有选项时,转到用户的主目录。 例如:% cd directory 2.4 删除目录 命令:rmdir (remove directory) 格式:rmdir directory_name 功能:删除不存在文件的子目录名。 注释: (1) 删除子目录时,要求被删除的目录中不存在文件或子目录,否则无法删除。 (2) 若被删除的目录中有文件或子目录,请参考命令rm -r directory_name。

相关主题
文本预览
相关文档 最新文档