从线程表里认出卡住的

👁️ 3 人浏览 💬 0 人评论 ❤️ 添加收藏

真机上 ps -L -o stat,comm 打出进程里每条线程的状态和名字。要在脚本里挑出「还活着的工人」,先在这里练:

lines = ["Ssl 服务", "Ssl 服务-心跳", "Rsl 服务-乙", "Ssl 服务-丁"]
workers = []
for l in lines:
    stat, name = l.split()
    if name.startswith("服务-") and name != "服务-心跳":
        workers.append(name + ":" + ("转" if stat.startswith("R") else "等"))
print(",".join(workers))
提交你的答案
请登录后提交答案。
去登录
代码编辑器
Ctrl + Enter 运行
本次输入:
输出:

                        
👩‍🏫
AI
💬 题目评论

全部评论