Comparison: Hard link and symbolic link

本文对比了硬链接和符号链接在不同条件下的优缺点。硬链接在名称解析速度、静态对象处理和对象存在要求方面表现更佳;而符号链接则在对象删除、动态对象属性更改速度及跨越文件系统方面更具优势。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

When using path names in programs, you have a choice of using a hard link or a symbolic link (see Link). Each type of link has advantages and disadvantages. The conditions under which one type of link has an advantage over the other type is as follows:

Table 1. Comparison of Hard Link and Symbolic Link

Item Hard Link Symbolic Link
Name resolution Faster. A hard link contains a direct reference to the object. Slower. A symbolic link contains a path name to the object, which must be resolved to find the object.
Object existence Required. An object must exist in order to create a hard link to it. Optional. A symbolic link can be created when the object it refers to does not exist.
Object deletion Restricted. All hard links to an object must be unlinked (removed) to delete the object. Unrestricted. An object can be deleted even if there are symbolic links referring to it.
Dynamic objects (attributes change) Slower. Many of the attributes of an object are stored in each hard link. Changes to a dynamic object, therefore, are slower as the number of hard links to the object increases. Faster. Changes to a dynamic object are not affected by symbolic links.
Static objects (attributes do not change) Faster. For a static object, name resolution is the primary performance concern. Name resolution is faster when hard links are used. Slower. Name resolution is slower when symbolic links are used.
Scope Restricted. Hard links cannot cross file systems. Unrestricted. Symbolic links can cross file systems.

 

 

nwtgz:/opt/orahome/app/oracle92/product/9.2.0.1.0$ ls -li wwg
total 2
    511459 drwxr-xr-x  30 oracle   oinstall    1024 Jan 21  2005 admin

nwtgz:/opt/orahome/app/oracle92/product/9.2.0.1.0$ find . -inum 511459
./wwg/admin

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值